Skip to content
Prev 16884 / 398513 Next

ASCII characters: from decimal code to R octal?

I was looking at the same problem/question last year (r-help May 09, 2001)
and what I ended up doing was what you suggests: a lookup table. See

   http://www.r-project.org/nocvs/mail/r-help/2001/2452.html

for a cut-n-paste complete solution, which I use myself.

I believe you could also to something like

octToChar <- function(octal) {
  code <- paste("\"\\", octal, "\"", sep="");
  eval(parse(text=code))
}

Except from fact that this example is not where robust ('octal' is
actually decimal), it is probably not very efficient.

Cheers

Henrik Bengtsson

Dept. of Mathematical Statistics @ Centre for Mathematical Sciences 
Lund Institute of Technology/Lund University, Sweden (+2h UTC)
Office: P316, +46 46 222 9611 (phone), +46 46 222 4623 (fax)
h b @ m a t h s . l t h . s e
http://www.maths.lth.se/matstat/staff/hb/
On Mon, 4 Feb 2002, David Firth wrote:

            
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._