On 6/5/07, Alberto Monteiro <[EMAIL PROTECTED]> wrote:
> Prof Brian Ripley wrote:
> >
> >> I must be sleeping, but I can't think about a program that lists
> >> "all" Unicode characters. A stupid and dirty solution would be:
> >
> > You realize there are millions of them?  (2^21, in theory.)
> >
> :-) Yes, but in Windows there are only 256...
>
> >> cat("u 31 = \u31\n")
> >> cat("u 32 = \u32\n")
> >> ...
> >>
> >> How can I vectorize this?
> >
> > ?intToUtf8
> >
> > E.g. to look at a range around U+2113,
> >
> > cat(intToUtf8(0x2110L+0:9, TRUE), "\n")
> >
> This does not work in R 2.4.1 for Windows. 0x2110L returns
> an error, and intToUtf8 returns an error on anything except
> the simplest calls:
>
> intToUtf8(33) # error. Argument x must be an integer vector
> intToUtf8(33:35) # ok
> intToUtf8(40 + 0:9) # error. Argument x must be an integer vector

Well you need to give it integers!

intToUtf8(33L)
intToUtf8(40L + 0:9)

Hadley

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to