[R] Translation of the charter

Heinz Tuechler tuech|er @end|ng |rom gmx@@t
Tue Nov 2 07:22:42 CET 2021


Alice wrote/hat geschrieben on/am 31.10.2021 07:33:
> Dear members,
>
> How to translate the charter to the underline inter?
> I tried this:
>
>> x <- c("a","b","c")
>
>> as.numeric(x)
>
> [1] NA NA NA
>
> Warning message:
>
> NAs introduced by coercion
>
>
> It didn't work.
>
> Sorry for my newbie questions.
>
>
> B.R.
>
> Alice
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using 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.
>
Is this, what you are looking for:

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

best,
Heinz



More information about the R-help mailing list