Here's a short overview of how to run some Python code in R:
# (1) basic python commands called from R
system('python -c "a = 2 + 2; print a"')
system('python -c "a = \'hello world\' ; print a; import pandas"')
# (2) if you have a python file you've already created (which I've
# referred to as "my.py"), then you can run it in R as follows:
system("python C:\\Users\\Name\\Desktop\\my.py")
# or alternatively:
system('python -c "import sys; sys.path.append(\'C:\\Users\\Name\\Desktop\');
import my;"')