[R] perfectionism

Jack Tanner ihok at hotmail.com
Fri Nov 25 20:50:35 CET 2011


jim holtman <jholtman <at> gmail.com> writes:

> > match(f, names(z))
> [1] 2 3

Jim, thanks so much, that's right on.

Patrick, thanks to you too, but yours is not the same as what I asked:

> z <- c(3,4,5,4)
> names(z)<- c("a","b","c","b")
> z[f]
b c 
4 5

Yours returns the actual values in z, not the indexes in z, i.e., not

[1] 2 3



More information about the R-help mailing list