Dear list, I have a data frame like:> log2.ratios[1:3,1:4]Clone a1 a2 a3 1 GS1-232B23 -0.0207500 0.17553833 0.21939333 2 RP11-82D16 -0.1896667 0.02645167 -0.03112333 3 RP11-62M23 -0.1761700 0.08214500 -0.04877000 how to make it to look like:> log2.ratios[1:3,1:4]a1 a2 a3 a4 GS1-232B23 -0.0207500 0.17553833 0.21939333 0.0008 RP11-82D16 -0.1896667 0.02645167 -0.03112333 0.007 RP11-62M23 -0.1761700 0.08214500 -0.04877000 0.7666 I tried as.matrix(log2.ratios) and it seems it is not working. Thanks a lot! Allen [[alternative HTML version deleted]]
affy snp wrote:> > Dear list, > I have a data frame like: > >> log2.ratios[1:3,1:4] > Clone a1 a2 a3 > 1 GS1-232B23 -0.0207500 0.17553833 0.21939333 > 2 RP11-82D16 -0.1896667 0.02645167 -0.03112333 > 3 RP11-62M23 -0.1761700 0.08214500 -0.04877000 > > how to make it to look like: > >> log2.ratios[1:3,1:4] > a1 a2 a3 > a4 > GS1-232B23 -0.0207500 0.17553833 0.21939333 0.0008 > RP11-82D16 -0.1896667 0.02645167 -0.03112333 0.007 > RP11-62M23 -0.1761700 0.08214500 -0.04877000 0.7666 >log2.ratios = data.frame( Clone=c("GS1-232B23", "RP11-82D16", "RP11-62M23"), a1= c(-0.0207500,-0.1896667,-0.1761700), a2 = c(0.17553833,0.02645167,0.08214500), a3 = c(0.21939333,-0.03112333,-0.04877000), a4 = c(0.0008,0.007,0.7666)) log2.ratios[1:3,1:4] rownames(log2.ratios) <- as.character(log2.ratios[,1]) log2.ratios <- log2.ratios[,-1] -- View this message in context: http://www.nabble.com/How-to-manipulate-a-data-frame-tf4898180.html#a14030339 Sent from the R help mailing list archive at Nabble.com.
Hi I just guess what you want but maybe rownames(log2.ratios) <-log2ratios$Clone changes rownames and then you could get your output (after getting rid of first column). If you just want an output to spreadsheet without row names column, look at ?write.table especially row.names option. regards Petr petr.pikal at precheza.cz r-help-bounces at r-project.org napsal dne 29.11.2007 17:06:57:> Dear list, > I have a data frame like: > > > log2.ratios[1:3,1:4] > Clone a1 a2 a3 > 1 GS1-232B23 -0.0207500 0.17553833 0.21939333 > 2 RP11-82D16 -0.1896667 0.02645167 -0.03112333 > 3 RP11-62M23 -0.1761700 0.08214500 -0.04877000 > > how to make it to look like: > > > log2.ratios[1:3,1:4] > a1 a2 a3 > a4 > GS1-232B23 -0.0207500 0.17553833 0.21939333 0.0008 > RP11-82D16 -0.1896667 0.02645167 -0.03112333 0.007 > RP11-62M23 -0.1761700 0.08214500 -0.04877000 0.7666 > > I tried as.matrix(log2.ratios) and it seems it is not working. > > Thanks a lot! > > Allen > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.