It looks like your row numbers are "characters" because that is the
sort sequence you are getting. Try
df <- df[order(as.numeric(rownames(df))), ]
On Wed, May 18, 2011 at 2:42 PM, David Kaplan
<dkaplan at education.wisc.edu> wrote:> Greetings,
>
> I'm trying to simply reorder a data frame on the row numbers. ?So, for
> example, instead of getting 1,2,3,4,5,6,7,8,9,10,11, ... 100 ..., ?I get
> instead
> 1, 10, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 11, ... ? I've
> tried commands such as
>
> df <- df[order(rownames(df)),] and
>
> and have substituted the order command with sort and sort.list to no
> avail. ?Any advice would be appreciated. ?Thanks in advance.
>
> David
>
> --
>
> ======================================================================>
David Kaplan, Ph.D.
> Professor
> Department of Educational Psychology
> University of Wisconsin - Madison
> Educational Sciences, Room, 1082B
> 1025 W. Johnson Street
> Madison, WI 53706
>
> email: dkaplan at education.wisc.edu
> homepage:
> http://www.education.wisc.edu/edpsych/default.aspx?content=kaplan.html
> Phone: 608-262-0836
> ======================================================================>
>
>
>
> ? ? ? ?[[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 guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
Jim Holtman
Data Munger Guru
What is the problem that you are trying to solve?