This might be off base, but would using --args help? It means "ignore everything else, Mr. R executable". However you can still parse it within the R environment.
I use something like this in my startup file (.site file): if("--args" %in% commandArgs()){ i=grep("--args", commandArgs()) args=commandArgs()[(i+1):length(commandArgs)] } On Mon, Mar 14, 2011 at 3:27 PM, Fong Chun Chan <fongc...@interchange.ubc.ca > wrote: > 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@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. > [[alternative HTML version deleted]] ______________________________________________ R-help@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.