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

______________________________________________
R-help@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.

Reply via email to