Re: [R] Save File after order
Thanks -- View this message in context: http://r.789695.n4.nabble.com/Save-File-after-order-tp4484539p4485370.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.
Re: [R] Save File after order
It doesn't have anything to do with your use of order(). Those are the row names of your data frame. You can disable writing them with the row.names=FALSE argument to write.table(). Sarah On Mon, Mar 19, 2012 at 8:16 AM, MSousa wrote: > Hello, > > I'm trying to write the sorted data in a file of a data.frame, My > question and my problem is that when I record in file adds a new column > row.name, which apparently is the original position in the file. > I wanted to write to the file without this column > > x<-data.frame(name="x1",Time=20) > x<-rbind(x,data.frame(name="x2",Time=25)) > x<-rbind(x,data.frame(name="x3",Time=23)) > x<-rbind(x,data.frame(name="x2",Time=45)) > x<-rbind(x,data.frame(name="x1",Time=25)) > x<-rbind(x,data.frame(name="x1",Time=55)) > > x<-x[order(x$name),] > View(x) > write.csv(data.frame(x$name,x$Time), file = "~/Desktop/DatasetOrder.csv") > In this momment save this > name Time > 1 x1 20 > 5 x1 25 > 6 x1 55 > 2 x2 25 > 4 x2 45 > 3 x3 23 > > The ideia is save > name Time > x1 20 > x1 25 > x1 55 > x2 25 > x2 45 > x3 23 > > Thanks > -- Sarah Goslee http://www.functionaldiversity.org __ 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.
[R] Save File after order
Hello, I'm trying to write the sorted data in a file of a data.frame, My question and my problem is that when I record in file adds a new column row.name, which apparently is the original position in the file. I wanted to write to the file without this column x<-data.frame(name="x1",Time=20) x<-rbind(x,data.frame(name="x2",Time=25)) x<-rbind(x,data.frame(name="x3",Time=23)) x<-rbind(x,data.frame(name="x2",Time=45)) x<-rbind(x,data.frame(name="x1",Time=25)) x<-rbind(x,data.frame(name="x1",Time=55)) x<-x[order(x$name),] View(x) write.csv(data.frame(x$name,x$Time), file = "~/Desktop/DatasetOrder.csv") In this momment save this name Time 1 x1 20 5 x1 25 6 x1 55 2 x2 25 4 x2 45 3 x3 23 The ideia is save name Time x1 20 x1 25 x1 55 x2 25 x2 45 x3 23 Thanks -- View this message in context: http://r.789695.n4.nabble.com/Save-File-after-order-tp4484539p4484539.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.