> 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/ ______________________________________________ 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.