[R] R scripts and parameters

2009-02-17 Thread mauede
A couple of weeks ago I asked how it is possible to run an R script (not a function) passing some parameters. Someone suggested the function "commandArgs()". I read the on-line help and found no clarifying example. Therefore I do not know how to use it appropriately. I noticed this function retur

Re: [R] R scripts and parameters

2009-02-17 Thread Gabor Grothendieck
Try this: A <- 1 B <- 2 C <- 3 source("myfile.R") Now the code in myfile can access A, B and C. On Tue, Feb 17, 2009 at 10:55 AM, wrote: > A couple of weeks ago I asked how it is possible to run an R script (not a > function) passing some parameters. > Someone suggested the function "commandA

Re: [R] R scripts and parameters

2009-02-17 Thread Duncan Murdoch
On 2/17/2009 10:55 AM, mau...@alice.it wrote: A couple of weeks ago I asked how it is possible to run an R script (not a function) passing some parameters. Someone suggested the function "commandArgs()". I read the on-line help and found no clarifying example. Therefore I do not know how to use

[R] R: R scripts and parameters

2009-02-18 Thread mauede
elp is welcome. Thank you. Maura -Messaggio originale- Da: Duncan Murdoch [mailto:murd...@stats.uwo.ca] Inviato: mar 17/02/2009 17.34 A: mau...@alice.it Cc: r-h...@stat.math.ethz.ch Oggetto: Re: [R] R scripts and parameters On 2/17/2009 10:55 AM, mau...@alice.it wrote: > A couple o

Re: [R] R scripts and parameters

2009-02-20 Thread Jeffrey J. Hallman
Here's how I do this: The last lines of my .First() function are these: ## Run command line program if there is one if(length(.cmd <- commandArgs(trailingOnly = TRUE)) > 0) try(source(textConnection(.cmd), echo = T, prompt.echo = "> ")) and on my Linux path I have this csh script, called "runR"

Re: [R] R: R scripts and parameters

2009-02-19 Thread Prof Brian Ripley
rd...@stats.uwo.ca] Inviato: mar 17/02/2009 17.34 A: mau...@alice.it Cc: r-h...@stat.math.ethz.ch Oggetto: Re: [R] R scripts and parameters On 2/17/2009 10:55 AM, mau...@alice.it wrote: A couple of weeks ago I asked how it is possible to run an R script (not a function) passing some parameters. S