[R] ordering a data frame to same order as a chr vector

Liaw, Andy andy_liaw at merck.com
Mon Jan 23 17:10:34 CET 2006


This is an FAQ that's not in the official FAQ (I believe).  Do
RSiteSearch("sort.data.frame") in R and you'll see.

Andy

From: Ken Termiso
> 
> Hi all,
> 
> I've got a data frame that has an identical column to a chr 
> vector. I would 
> like to use the chr vector to order the rows of the data frame to be 
> identical to the order in the chr vector (the contents of the 
> chr vector are 
> completely identical to one col of the data frame), but this 
> is proving 
> trickier than it sounds..
> 
> Any help would be much obliged,
> -Ken
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
>




More information about the R-help mailing list