Reputation: 4784
I have created a Windows 7 shortcut in an attempt to give someone who is not comfortable with R the ability to run a simple program. I have tried to follow the advice of other postings, but must be missing something. This is what I have in my shortcut right now.
Target: "C:\Program Files\R\R-3.0.2\bin\x64\Rscript.exe" --vanilla -e "C:\Users\Moo\Desktop\CharCalendar.r"
Start in: "C:\Program Files\R\R-3.0.2\bin\x64"
I get error messages (that flash up very briefly on a black DOS window) that say things like Error unexpected input in "C:\"
I have tried with and without quotes in the target, I have tried using source() in the target (also with and without quotes).
The script runs without error when I submit it in the R console.
Upvotes: 3
Views: 2937
Reputation: 1437
Replace Rscript.exe -e
with Rterm.exe -f
, which indicates that you are passing a file as argument, -e
is for passing expressions e.g. Rscript.exe -e "a<-1:10; mean(a);"
Rterm provides a few more options for control compared to Rscript, see Rterm.exe --help
.
Upvotes: 0
Reputation: 57686
You probably want
"C:\Program Files\R\R-3.0.2\bin\x64\Rscript.exe" --vanilla C:\Users\Moo\Desktop\CharCalendar.r
as your target. No -e
; that specifies an expression to run, not a script file.
Upvotes: 3
Reputation: 1435
I must admit, I hardly ever made my own shortcut in Windows. However, you coul seemly write a bat-file which runs the R-script and PAUSES, so you can read the output:
@echo off
"C:\Program Files\R\R-3.0.2\bin\x64\Rscript.exe" "C:\Users\Moo\Desktop\CharCalendar.r"
PAUSE
You may also want to add additional options and arguments after Rscript.exe
. If you want to pass it to Rgui.exe
, it will be a trickier. Read the following stackoverflow-topic for hints:
Passing script as parameter to RGui
Upvotes: 0