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.oo::charToInt(x)# [1] 97 98 99 On Mon, Nov 1, 2021 at 9:48 PM Alice <alice at coakmail.com> wrote:> > 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 at 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.
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 at 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