Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Running RScript from Stata, invoking R, but script not executing.

    Hello,

    I am trying to run RScript from Stata. I only need the RScript to execute, it picks up a file and saves it afterwards. The Rscript works well when executing it in RStudio.

    When I use "shell" or "rsource" the script is invoked but it doesn't seem to execute.

    shell "C:/Program Files/R/R-3.5.0/bin/R.exe" --vanilla <"${VApath}\myscript.R"
    rsource using "${VApath}\myscript.R", rpath("C:/Program Files/R/R-3.5.0/bin/R.exe") roptions(`"--vanilla"')


    The RScript uses multiple packages, one of which requires Java, but all the packages are already installed. It also uses an environmental variable. After running the command in Stata I get an R.history file that is the current time and date. I also tried to direct to the RStudio exe, then Rstudio opens with the RScript, but does not run it.


    I used shell on a more simple RScript which worked, so perhaps it is something to do with the contents of the RScript, although I am not sure why that should matter.

    Any advice would be very appreciated, I know very little R so apologies if it is obvious.

    Thanks

    Milly







Working...
X