[R] help matching rows of a data frame

Therneau, Terry M., Ph.D. therneau at mayo.edu
Mon Sep 18 14:13:34 CEST 2017


This question likely has a 1 line answer, I'm just not seeing it.  (2, 3, or 10 lines is 
fine too.)

For a vector I can do group  <- match(x, unqiue(x)) to get a vector that labels each 
element of x.
What is an equivalent if x is a data frame?

The result does not have to be fast: the data set will have < 100 elements.  Since this is 
inside the survival package, and that package is on  the 'recommended' list, I can't 
depend on any package outside the recommended list.

Terry T.



More information about the R-help mailing list