Re: [R] Loading workspaces from the command line

2010-03-16 Thread Wincent
It is a promising solution. Yet, there is room for improvement. I revise the if condition so it won't throw an error during ordinary startup. .First <- function() { if (length(commandArgs(T))>0 && commandArgs(T)[1] == "ld"){ load(commandArgs(T)[-1], .GlobalEnv) } } For the Rload script, i

Re: [R] Loading workspaces from the command line

2009-01-12 Thread Zhou Fang
Well, that isn't ideal for my purposes. (A little context - basically I have a script that I'm running for a lot of simulations, which is kinda buggy, and what I'm doing is I'm having the script periodically save whatever it has done so far to an automatically named file. Then if something odd happ

Re: [R] Loading workspaces from the command line

2009-01-12 Thread Gabor Grothendieck
Another possibility is to have a separate directory for each project and place an .RData file in each. Now just cd to whatever directory corresponds to the project you wish to work on and start R normally. No code is needed. On Mon, Jan 12, 2009 at 10:04 AM, Zhou Fang wrote: > Ok, looks like I ca

Re: [R] Loading workspaces from the command line

2009-01-12 Thread Zhou Fang
Ok, looks like I can do what I want with --args, commandArgs() and an appropiate .First. Thanks, Zhou On Mon, Jan 12, 2009 at 2:27 PM, David Winsemius wrote: > See if this material is helpful: > > http://cran.r-project.org/doc/manuals/R-intro.html#Invoking-R-from-the-command-line > > -- David W

Re: [R] Loading workspaces from the command line

2009-01-12 Thread David Winsemius
See if this material is helpful: http://cran.r-project.org/doc/manuals/R-intro.html#Invoking-R-from-the-command-line -- David Winsemius On Jan 12, 2009, at 7:24 AM, Zhou Fang wrote: That's not really what I meant by 'command line'. I meant, well, loading from e.g. a bash shell, not from wi

Re: [R] Loading workspaces from the command line

2009-01-12 Thread Zhou Fang
That's not really what I meant by 'command line'. I meant, well, loading from e.g. a bash shell, not from within an interactive R session itself. Thanks anyways, Zhou (Possibly this email was sent twice. Apologies) On Mon, Jan 12, 2009 at 12:15 PM, Henrique Dallazuanna wrote: > See ?load > > O

Re: [R] Loading workspaces from the command line

2009-01-12 Thread Henrique Dallazuanna
See ?load On Mon, Jan 12, 2009 at 10:12 AM, Zhou Fang wrote: > Hi, > > Is there any way to load workspaces (e.g. stuff from save.image) from > the command line? I'm on Linux, and would find this very helpful. > > I'm guessing this functionality can be duplicated with a skillful bash > script to