I have made many different attempts to run a R program in Batch mode. I run a DOS command like: C:\Progra~1\R\rw1061\bin\rterm.exe -q --no-restore --no-save myprogram.R out.txt What happens: 1. DOS Shell starts up well 2. R starts 3. I get the messages: "ARGUMENT 'myprogram.R' __ignored__" "ARGUMENT 'out.txt' __ignored__" 4. R Shell is ready to roll (which is nice, but not what I intended to get) Help is greatly appreciated: how can I start myprogram.R? -- Wolfgang Scherr Innovative Transportation Concepts, Inc. 302-654-4384 phone wscherr at itc-world.com www.itc-world.com
Wolfgang Scherr wrote:> > I have made many different attempts to run a R program in Batch mode. I run a DOS command like: > > C:\Progra~1\R\rw1061\bin\rterm.exe -q --no-restore --no-save myprogram.R out.txt > > What happens: > 1. DOS Shell starts up well > 2. R starts > 3. I get the messages: > "ARGUMENT 'myprogram.R' __ignored__" > "ARGUMENT 'out.txt' __ignored__" > 4. R Shell is ready to roll (which is nice, but not what I intended to get) > > Help is greatly appreciated: how can I start myprogram.R?See the R for Windows FAQs, Section 2.9: "Can I use R BATCH?" Uwe Ligges
ripley@stats.ox.ac.uk
2003-Jan-08 15:38 UTC
[R] Errors running R in Batch mode under Win2000
See the rw-FAQ. Please do check the FAQs before posting. This is not how you start any C program in batch mode under any OS I am aware of, and certainly not under Windows. You need to learn about redirection (< and >). On Wed, 8 Jan 2003, Wolfgang Scherr wrote:> I have made many different attempts to run a R program in Batch mode. I run a DOS command like: > > C:\Progra~1\R\rw1061\bin\rterm.exe -q --no-restore --no-save myprogram.R out.txt > > What happens: > 1. DOS Shell starts up well > 2. R starts > 3. I get the messages: > "ARGUMENT 'myprogram.R' __ignored__" > "ARGUMENT 'out.txt' __ignored__" > 4. R Shell is ready to roll (which is nice, but not what I intended to get) > > Help is greatly appreciated: how can I start myprogram.R?-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
I am trying (I think) to achieve something like "sweep" for data frames. I have a data frame. Two columns are factors, say with L and M levels; one is numeric. Within each of L*M classes of observations, I would like to normalize the numerical value by its mean. Here is an example of what I mean. data <- data.frame( fac1=c("A","A","B","B","B"), fac2=c("a","b","a","a","b"), x=rnorm(5)) split.names <- c("fac1","fac2") t <- tapply(data$x, data[split.names], mean) # now t is an array, and I can index it like this: t["A","b"] # I want to do something like data$xnorm <- data$x / t[data[split.names]] # but I am told: Error: invalid subscript type I would like to retrieve a vector of the values of the t-array, one item in the vector for each row of the data frame. I would be grateful for instructions. I think I could also achieve this by creating a data frame instead of the table t, as in Venables+Ripley MASS (4th ed) p. 39, and then merging the tables, as on p. 35. Is this the most effective way to achieve what I want, or is there a more direct way? Damon.