[R] Getting the character set
Prof Brian Ripley
ripley at stats.ox.ac.uk
Wed Jun 15 18:09:05 CEST 2005
On Wed, 15 Jun 2005, Halldor Björnsson wrote:
> Hi R-gurus,
>
> In python one can do
> >>> import string
> >>> print string.letters
>
> and get the characters in the local character set.
>
> This feature is often useful in Python, and if I could find it in R
> I could make good use of it.
>
> In R both Sys.getlocale() and localeToCharset() can tell me which
> charset I am using, but I haven't found a way to print out the
> actual characters. Is there a way to do this?
No. There could be 2 billion of them, so I doubt Python really does as
you say.
In an 8-bit character set you can use
rawToChar(as.raw(0:255), TRUE)
but you might have a 21-bit character set.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list