[R] letters to numbers conversion
p.connolly at hortresearch.co.nz
Fri May 2 06:57:23 CEST 2003
On Fri, 02-May-2003 at 04:42AM +0000, Andrew C. Ward wrote:
|> How about the following?
|> t1 <- matrix(letters[1:9], nrow=3, byrow=TRUE)
|> t2 <- t(apply(t1, 1, function(x) match(x, letters)))
Or slightly more simply
t2 <- apply(t1, 2, function(x) match(x, letters))
Might not work for non-unique letters.
Ph: +64-9 815 4200 x 7188
I have the world`s largest collection of seashells. I keep it on all
the beaches of the world ... Perhaps you`ve seen it. ---Steven Wright
More information about the R-help