[R] letters to numbers conversion

Robin Hankin r.hankin at auckland.ac.nz
Fri May 2 06:28:17 CEST 2003


Hello List

How do I turn

R> simple.example.alphabetic
     [,1] [,2] [,3]
[1,] "a"  "b"  "c" 
[2,] "d"  "e"  "f" 
[3,] "g"  "h"  "i" 

into

R> simple.example.numeric
     [,1] [,2] [,3]
[1,]    1    2    3
[2,]    4    5    6
[3,]    7    8    9

[ie "a" becomes 1, ..., "z" becomes 26]
?






-- 

Robin Hankin, Lecturer,
School of Geography and Environmental Science
Tamaki Campus
Private Bag 92019 Auckland
New Zealand

r.hankin at auckland.ac.nz
tel 0064-9-373-7599 x6820; FAX 0064-9-373-7042



More information about the R-help mailing list