[R] Getting characters from integers

Duncan Murdoch murdoch at stats.uwo.ca
Wed Oct 10 16:22:48 CEST 2001

On Wed, 10 Oct 2001 09:55:25 -0300, you wrote in message
<3BC4453D.94ACB0E0 at acadiau.ca>:

>Hello All,
>I am creating a graph in a loop, and want to use letters for marking
>symbols.  Is there a function to convert an integer into a character.  I
>am looking for something similar to the ASC() function of good old
>BASIC, or the (char) type conversion of C.

There are the letters and LETTERS vectors.  For example,

 > letters[1:3]
 [1] "a" "b" "c"

I don't think there's any function that does general ASCII
conversions, but you could fairly easily enter your own vector of
characters if letters aren't sufficient.  I imagine you'll have a hard
time entering a null character.  If you're on some platforms, you
could write your own general typecasting function using a fifo, but
those aren't supported everywhere.

Duncan Murdoch
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 mailing list