[R] Inverting data frame...row wise
Daniel Malter
daniel at umd.edu
Thu Sep 25 23:39:53 CEST 2008
Sorry, I misread. I thought you want to get the columns inverted. It works
for rows analogously:
x=c(rep(1:10,4))
dim(x)=c(10,4)
x=data.frame(x)
x2=x[order(-1:-10),]
x2
-------------------------
cuncta stricte discussurus
-------------------------
-----Ursprüngliche Nachricht-----
Von: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] Im
Auftrag von milicic.marko
Gesendet: Thursday, September 25, 2008 5:24 PM
An: r-help at r-project.org
Betreff: [R] Inverting data frame...row wise
Hi,
I have the data.frame with 4 columns. I simply want to invert dataset so
that last row becomes first...
I tried with rev(my_data-frame) but I got my columns inverted... not my rows
Thanks
______________________________________________
R-help at 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.
More information about the R-help
mailing list