ID EN
Environment & Scope

Sys.localeconv

R Base 3.6.2 🇮🇩 Bahasa Indonesia

Dapatkan detail representasi numerik dan moneter di lokasi saat ini.

Syntax

R
Sys.localeconv()

Return Value

Vektor karakter dengan 18 komponen bernama. Lihat dokumentasi ISO C Anda untuk rincian maknanya. Dimungkinkan untuk mengkompilasi R tanpa dukungan lokal, dalam hal ini nilainya akan menjadi NULL.

Details

Biasanya R dijalankan tanpa melihat nilai LC_NUMERIC, sehingga koma desimalnya tetap '.'. Jadi tiga komponen pertama ini hanya akan berguna jika Anda telah menyetel kategori lokal LC_NUMERIC menggunakan Sys.setlocale di sesi R saat ini (ketika R mungkin tidak berfungsi dengan benar). Komponen moneter hanya akan ditetapkan ke nilai non-default (lihat bagian 'Contoh') jika kategori LC_MONETARY ditetapkan. Seringkali tidak disetel: berikan contoh cara memicu pengaturannya.

Contoh

Example
R
# NOT RUN {
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").
# }
# NOT RUN {
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)
# }
# NOT RUN {
# }
# NOT RUN {
read.table("foo", dec=Sys.localeconv()["decimal_point"])
# }

See Also

Sys.setlocale for ways to set locales.