I am trying to use retriculate to run python code from R. This works, for example I can run:
library(retriculate)
py_run_file("mypyfile.py")
where the mypyfile.py contains:
import pandas as pd
df = pd.DataFrame({a:[1,2], b:[3,4]})
df.to_csv(mypythongenerateddata.csv)
to keep things easier I would prefer to just place these three lines of python code in the R script directly, as opposed to sourcing the python script. The documentation seems to suggest using a markdownfile, which I am not to fond off. enter link description here