[R] How to use Sys.setlocale("LC_NUMERIC")?
Jano Kula
jano at mail-box.cz
Fri Dec 5 12:34:47 CET 2003
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.
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?
Thanks
Jano
More information about the R-help
mailing list