You can easily write a simple function to do that:

letters2num <- function(x) {
        nletters <- 1:length(LETTERS)
        names(nletters) <- LETTERS
        nletters[x]
}

> x <- c("A", "X", "F", "W", "G", "V", "L")
> letters2num(x)
 A  X  F  W  G  V  L 
 1 24  6 23  7 22 12 

-Christos
 
> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Leandro Marino
> Sent: Friday, March 06, 2009 10:06 AM
> To: [email protected]
> Subject: [R] Numbers
> 
>  Hi,
> 
> I know the function LETTERS, but, now I have some letters to 
> convert it in numbers, like A=1,B=2, etc... Is any function 
> to do that?
> 
> Atenciosamente,
> Leandro Lins Marino
> Centro de Avaliação
> Fundação CESGRANRIO
> Rua Santa Alexandrina, 1011 - 2º andar
> Rio de Janeiro, RJ - CEP: 20261-903
> R (21) 2103-9600 R.:236
> ( (21) 8777-7907
> ( [email protected]
> 
> "Aquele que suporta o peso da sociedade
>     é precisamente aquele que obtém
>  as menores vantagens". (SMITH, Adam)
> 
> P  Antes de imprimir pense em sua responsabilidade e 
> compromisso com o MEIO AMBIENTE 
> 
> ______________________________________________
> [email protected] 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.
> 

______________________________________________
[email protected] 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