Re: [R] Getting the character set

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Thu 16 Jun 2005 - 02:09:05 EST

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@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

______________________________________________ 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

Received on Thu Jun 16 02:18:36 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:42 EST