
Last chance! 50% off unlimited learning
Sale ends in
Sys.localeconv()
It is possible to compile Rwithout support for locales, in which
case the value will be NULL
.
.
'. So the first three of these
components will only be useful if you have set the locale category
LC_NUMERIC
using Sys.setlocale
in the current Rsession
(when Rmay not work correctly). The monetary components will only be set to non-default values (see
the LC_MONETARY
category is
set. It often is not set: set the examples for how to trigger setting it.
Sys.setlocale
for ways to set locales.Sys.localeconv()
## The results in the C locale are
## decimal_point thousands_sep grouping int_curr_symbol
## "." "" "" ""
## currency_symbol mon_decimal_point mon_thousands_sep mon_grouping
## "" "" "" ""
## positive_sign negative_sign int_frac_digits frac_digits
## "" "" "127" "127"
## p_cs_precedes p_sep_by_space n_cs_precedes n_sep_by_space
## "127" "127" "127" "127"
## p_sign_posn n_sign_posn
## "127" "127"
## Now try your default locale (which might be "C").
old <- Sys.getlocale()
## The category may not be set:
## the following may do so, but it might not be supported.
Sys.setlocale("LC_MONETARY", locale = "")
Sys.localeconv()
## or set an appropriate value yourself, e.g.
Sys.setlocale("LC_MONETARY", "de_AT")
Sys.localeconv()
Sys.setlocale(locale = old)
read.table("foo", dec=Sys.localeconv()["decimal_point"])
Run the code above in your browser using DataLab