[R] ASCII map?
henrikb at braju.com
Tue May 8 19:51:56 CEST 2001
Is there a way to convert between and integer and a character and vice
versa? For instance
i <- 65;
ch <- intToChar(i); # "A"
i <- charToInt(ch); # 65
or even better
i <- c(65, 66);
ch <- intToChar(i); # c("A", "B")
i <- charToInt(ch); # c(65, 66)
I have tried to do a ASCII map myself, and I figured out that the ASCII
characters can be generated by "\nn", where nn is a octal number. However,
is there already such a map (function) accessable?
Also, is it ok assume that a character string can contain any 7/8-bit ASCII
character (1-127/1-255)? The special value "\0" terminates the character
string. (Is "\0" in a character string safe? Example substring("abc\0def",
5) gives "", but what happens inside [R]?)
Reason for this is that I would like store subparts of the buffer that I
have read using readBin() as a character string, but I would also be able to
save it back using writeBin() without loosing anything.
Thanks for a great language!
h e n r i k b @ b r a j u . c o m
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help