Problems executing script from command line in R. Error message: cannot find path specified

前端 未结 2 1699
醉话见心
醉话见心 2021-02-08 12:28

I have been trying to execute a simple test.R

setwd(\"C:\\Users\\jdd\\Documents\")
test <- 2*6598
filename = \"test.csv\"
write.csv(test,file=filename)
         


        
2条回答
  •  日久生厌
    2021-02-08 12:50

    Thanks @sebastian-c! I tried to use RScript, which I investigated before. However, the problem was a different one. Appears that in my installation there is a R.exe and Rscript.exe file in .\bin, but also one in .\bin\x64. The first one is not working properly, but the second one is. The comment made by @Roland is very important as well, since once working I got this error message!

    The following command did the job:

    "C:\Program Files\R\R-2.15.2\bin\x64\Rscript.exe" "C:\Users\jdd\Documents\test.R"
    

    and the corrected text.R is:

    setwd("C:\\Users\\jdd\\Documents")
    test <- 2*6598
    filename = "test.csv"
    write.csv(test,file=filename)
    

提交回复
热议问题