Thanks for your help on this Hadley and David! Dennis Murphy also had a good solution (changing list(data.out2[-1])...etc to names(data.out2[-1]}...):
> data.out3 <- reshape(data.out2, direction = 'long', varying = names(data.out2[-1]), + idvar = 'id') > data.out4 <- split(data.out3, data.out3$time) > names(data.out4) <- paste('time', 1:4, sep = '') > data.out4 AC On Tue, Nov 24, 2009 at 9:05 PM, hadley wickham <h.wick...@gmail.com> wrote: > > I don't really understand what you want and the example solution throws > away > > quite a lot of data, so consider this alternative: > > > > data.out2 <- read.table(textConnection("id rater.1 n.1 rater.2 n.2 > > rater.3 n.3 rater.4 n.4 > > 11 11 0.1183333 79 NA NA NA NA NA NA > > 114 114 0.2478709 113 NA NA NA NA NA NA > > 12 12 0.3130655 54 0.3668242 54 NA NA NA NA > > 121 121 0.2400000 331 NA NA NA NA NA NA > > 122 122 0.3004164 25 0.1046278 25 0.2424871 25 0.2796937 25 > > 125 125 0.1634865 190 NA NA NA NA NA NA"), > header=T, > > stringsAsFactors=F) > > > > Or > > library(reshape) > df <- melt(data.out2, na.rm = T, id = "id") > df <- cbind(df, colsplit(df$variable, "\\.", c("var", "time"))) > > cast(df, id + time ~ var) > > See http://had.co.nz/reshape for more details. > > Hadley > > -- > http://had.co.nz/ > [[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.