Message-ID: <43000AEDF6B94226B68A4A9B80960734@headquarters.silicoinsights>
Date: 2009-03-06T15:32:23Z
From: Christos Hatzis
Subject: Numbers
In-Reply-To: <!&!AAAAAAAAAAAYAAAAAAAAAEadxqYXQLlLmuUnwe+aKQfCgAAAEAAAAKbz5L6lX9FOidPZYqpVL8kBAAAAAA==@cesgranrio.org.br>
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: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] On Behalf Of Leandro Marino
> Sent: Friday, March 06, 2009 10:06 AM
> To: r-help at r-project.org
> 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
> ( leandro at cesgranrio.org.br
>
> "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
>
> ______________________________________________
> R-help at 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.
>