Executing R script programmatically

后端 未结 5 854
臣服心动
臣服心动 2020-12-09 18:31

I have a C# program that generates some R code. Right now I save the script to file and then copy/paste it into the R console. I know there is a COM interface to R, but it d

5条回答
  •  孤城傲影
    2020-12-09 18:48

    To do this in C# you'll need to use

    shell (R CMD BATCH myRprogram.R)
    

    Be sure to wrap your plots like this

    pdf(file="myoutput.pdf")
    plot (x,y)
    dev.off()
    

    or image wrappers

提交回复
热议问题