hi, Heinz,
> You are right - match seems obviously better, but why not do
>
> x <- c("a","b","c")
> match(x, letters[])
no, really, i wasn't sure of the requirements!
cheers, Greg
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
h
Greg,
Greg Minshall wrote/hat geschrieben on/am 02.11.2021 08:57:
Heinz,
x <- c("a","b","c")
lettersnum <- 1:length(letters[])
names(lettersnum) <- letters[]
lettersnum[x]
lettersnum[x]
a b c
1 2 3
i'm not sure if the following is obviously better, but one might do
b <- match(a, a)
n
Heinz,
> x <- c("a","b","c")
> lettersnum <- 1:length(letters[])
> names(lettersnum) <- letters[]
> lettersnum[x]
> > lettersnum[x]
> a b c
> 1 2 3
i'm not sure if the following is obviously better, but one might do
> b <- match(a, a)
> names(b) <- a
> b
a b c
1 2 3
cheers, Greg
_
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
> R.oo::charToInt(x)
# [1] 97 98 99
On Mon, Nov 1, 2021 at 9:48 PM Alice 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
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]]
__
6 matches
Mail list logo