To convert strings to ascii code in R, I typically use:
> strtoi(charToRaw("abcd"),16L)
[1] 97 98 99 100
Is there a function to do the inverse, i.e.
>myDesiredFunc(c(97 98 99 100))
[1] "abcd"
Thanks.
I just noticed that R
has a intToUtf8
and utf8ToInt
functions that does the same thing.
> test<-utf8ToInt("Apples")
> test
[1] 65 112 112 108 101 115
> intToUtf8(test)
[1] "Apples"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With