[R] Rscript, hashbang, and arguments

From: Fong Chun Chan <fongchun_at_interchange.ubc.ca>
Date: Mon, 14 Mar 2011 13:27:30 -0700


Hi,

I have a bunch of R scripts which have the hash bang !/usr/bin/env Rscript and I typically run these scripts by passing in some parameters like this:

./nameOfRScript arg1 arg2 ...

I know Rscript has the option to run in --vanilla. Where exactly do I insert the --vanilla option? When I do something like this:

./nameOfRScript --vanilla arg1 arg2 ...

And I try to access the commandArgs, the first argument is --vanilla which isn't what I want. I tried to do commandArgs(trailingOnly=TRUE) with

./nameOfRScript --vanilla --args arg1 arg2 ...

But I sitll have the first argument as --vanilla. Does anyone know how to get around this? Thanks,

Fong

        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon 14 Mar 2011 - 21:01:56 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 14 Mar 2011 - 22:20:22 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive