[R] How to use Sys.setlocale("LC_NUMERIC")?
Prof Brian Ripley
ripley at stats.ox.ac.uk
Fri Dec 5 14:22:40 CET 2003
Have you consulted the help page?
On 5 Dec 2003, Jano Kula wrote:
> Can you help me to use Sys.setlocale("LC_NUMERIC", "cs_CZ") (comma as a
> decimal point) in some useful way, without all the workarounds?
>
> After switching to Sys.setlocale("LC_NUMERIC", "cs_CZ"):
>
> -- How do I set attributes in read.csv2() not to get columns of real
> numbers (decimal point = comma, field separator = semicolon) as factors?
>
> Wokrkaround: I can go backward with
> "as.numeric(levels(table$column))[table$column]".
>
> -- How do I separte values in a vector then? For example ylim=c(2.4,
> 3.5) -> ylim=c(2,4 ? 3,5), not to get a syntax error with the
> comma-decimal numbers?
>
> Workaround: I can set the value before I switch to "cz_CZ".
>
> -- And finally, how do I plot it to the postscript device with commas in
> labels (2,54), but with points in the postcsript commands (0.75
> setlinewidth)? I can understand this is a problem of postscript
> language/interpreter which doesn't use locales, but R's postscript
> driver should know, it can't use commas in PS-command arguments.
How is R's postscript driver supposed to know this? At least of its
authors would have expected that you wanted commas in PostScript (sic)
commands under that locale setting. You `should' not blame your tools for
obeying your instructions.
> Workaround: I can use "pretty()" and "as.character()" with default "C"
> locales but all in all: what for is Sys.setlocale("LC_NUMERIC") good for
> then?
Who said it was `good for' anything? Not the help page which warns
against this, although you give us no credit for that.
--
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