> tdf <- read.table(textConnection("ID samp1 samp2 samp3 samp4 + G1 23 32 12 87 + G2 85 45 49 76 + G3 12 46 39 28 + G4 73 26 18 13 + "), header=T) > library(reshape) > recast(tdf, ...~ID) Using ID as id variables variable G1 G2 G3 G4 1 samp1 23 85 12 73 2 samp2 32 45 46 26 3 samp3 12 49 39 18 4 samp4 87 76 28 13 >
see reshape and plyr packages for this kind of data manipulation. These packages can be helpful if you know what you want, but to start off it is sometimes more important to do things explicitly. While I think that plyr is definitively a must, getting the syntax right in reshape often needs longer than writing the explicit code. Dieter -- View this message in context: http://www.nabble.com/reading-transposed-data-in-read.csv-tp24979445p24985038.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.