Paul Johnson
2012-Oct-18 16:56 UTC
[R] good documentation on use of Rscript. where to find?
What is the correct format for the shebang line and what options are allowed or necessary along with this? I find plenty of blogs and opinions, but few authoritative answers. I want an R script to run and update packages periodically, with a cron job that launches it. What is necessary to put in line one of the R program. Aside from the basic part #!/usr/bin/Rscript what else can there be, or should there be? Various people suggest adding things like "--vanilla" but those seem not to be accepted, at least on RedHat EL 6 with R-2.15.1. I'd like to run this with a command line like: $ R-labSelectInstall-02.R > /tmp/Rupdate.txt 2>&1 so that all the standard output and err goes to a text file, but I've not found a way to make it work comparably to the R command line option --vanilla or such. # ./R-labSelectInstall-02.R --vanilla 'ARNING: unknown option '--vanilla See what I mean? -- Paul E. Johnson Professor, Political Science Assoc. Director 1541 Lilac Lane, Room 504 Center for Research Methods University of Kansas University of Kansas http://pj.freefaculty.org http://quant.ku.edu
Duncan Murdoch
2012-Oct-18 17:11 UTC
[R] good documentation on use of Rscript. where to find?
On 18/10/2012 12:56 PM, Paul Johnson wrote:> What is the correct format for the shebang line and what options are > allowed or necessary along with this? > > I find plenty of blogs and opinions, but few authoritative answers.The authoritative source for the options is the R help page ?Rscript. The authoritative answers for the format are likely slightly more difficult, because it is your shell that processes the file, it's not R handling the command line. But ?Rscript does give examples. Duncan Murdoch> > I want an R script to run and update packages periodically, with a > cron job that launches it. What is necessary to put in > line one of the R program. Aside from the basic part > > #!/usr/bin/Rscript > > what else can there be, or should there be? > > Various people suggest adding things like "--vanilla" but those seem > not to be accepted, at least on RedHat EL 6 with R-2.15.1. I'd like > to run this with a command line like: > > $ R-labSelectInstall-02.R > /tmp/Rupdate.txt 2>&1 > > so that all the standard output and err goes to a text file, but I've > not found a way to make it work comparably to the R command line > option --vanilla or such. > > # ./R-labSelectInstall-02.R --vanilla > 'ARNING: unknown option '--vanilla > > See what I mean? >