Heinz,

> x <- c("a","b","c")
> lettersnum <- 1:length(letters[])
> names(lettersnum) <- letters[]
> lettersnum[x]
> > lettersnum[x]
> a b c
> 1 2 3

i'm not sure if the following is obviously better, but one might do
----
> b <- match(a, a)
> names(b) <- a
> b
a b c
1 2 3
----

cheers, Greg

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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