Re: [R] Multiple line commands in R scripting

2009-10-26 Thread Neil Stewart
I guess I'll have to be really careful about my line breaks. Thank you all for your help! __ 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 p

[R] Multiple line commands in R scripting

2009-10-25 Thread Neil Stewart
I'm wondering whether there is a character to let R know to expect more input for a command on subsequent lines. Here is an example: test_1.R: x <- c(1,2,3,4) / c(1,2,3,4) x R CMD BATCh test_1.R produces test_1.Rout: > x <- c(1,2,3,4) > / c(1,2,3,4) Error: unexpected '/' in " /" Execution

Re: [R] reshape with two time variables

2009-01-31 Thread Neil Stewart
Thank you all so much for your help. I've gone with repeated_measures_data.csv: sub,A1B1,A1B2,A2B1,A2B2 s1,400,475,420,510 s2,390,500,470,472 s3,428,512,555,610 s4,703,787,801,822 s5,611,634,721,705 s6,543,522,612,788 s7,411,488,506,623 s8,654,644,711,795 library(reshape) data<-read.csv("repeate

[R] reshape with two time variables

2009-01-30 Thread Neil Stewart
I have a data frame in wide format that I'd like to convert to long format. For example, in wide format I have: id A1B1A1B2A2B1A2B2 1 1 400 475 420 510 2 2 390 500 470 472 3 3 428 512 555 610 4 4

[R] Neat conditional assignment

2007-12-10 Thread Neil Stewart
I would like to make a new vector with values taken from two existing vectors conditional upon a third. At present I am doing this with a for loop but wonder if there is not a neater way, given some of the very neat things R can do. a<-rep(c("A","B"),50) b<-rep(1,100) c<-rep(2,100) a is thus "A"