[R] Equivalent of match for data.frame
Sébastien
pomchip at free.fr
Sat Jan 3 13:24:38 CET 2009
Dear R-users,
I am translating a S script into R and having some troubles with the
match function. This function appears to work with vector and data.frame
in S, but not in R, e.g.:
a <- rep((1:4), each = 10)
b <- rep((1:10), times = 4)
mydf <- data.frame(a,b)
myarg <- mydf[1,]
match(myarg, mydf)
# S returns 1 but R returns NA NA
I guess one could use match(interaction(myarg), interaction(mydf)) to do
the job but I was just wondering if there was a more direct function.
Thanks,
Sebastien
More information about the R-help
mailing list