[R] Save File after order
Sarah Goslee
sarah.goslee at gmail.com
Mon Mar 19 15:32:57 CET 2012
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 <ricardosousa2000 at clix.pt> 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
More information about the R-help
mailing list