A locale object tries to capture all the defaults that can vary between
countries. You set the locale in once, and the details are automatically
passed on down to the columns parsers. The defaults have been chosen to
match R (i.e. US English) as closely as possible. See
vignette("locales")
for more details.
locale(
date_names = "en",
date_format = "%AD",
time_format = "%AT",
decimal_mark = ".",
grouping_mark = ",",
tz = "UTC",
encoding = "UTF-8",
asciify = FALSE
)default_locale()
Character representations of day and month names. Either
the language code as string (passed on to date_names_lang()
)
or an object created by date_names()
.
Default date and time formats.
Symbols used to indicate the decimal
place, and to chunk larger numbers. Decimal mark can only be ,
or
.
.
Default tz. This is used both for input (if the time zone isn't present in individual strings), and for output (to control the default display). The default is to use "UTC", a time zone that does not use daylight savings time (DST) and hence is typically most useful for data. The absence of time zones makes it approximately 50x faster to generate UTC times than any other time zone.
Use ""
to use the system default time zone, but beware that this
will not be reproducible across systems.
For a complete list of possible time zones, see OlsonNames()
.
Americans, note that "EST" is a Canadian time zone that does not have
DST. It is not Eastern Standard Time. It's better to use
"US/Eastern", "US/Central" etc.
Default encoding. This only affects how the file is read - readr always converts the output to UTF-8.
Should diacritics be stripped from date names and converted to ASCII? This is useful if you're dealing with ASCII data where the correct spellings have been lost. Requires the stringi package.
locale()
locale("fr")
# South American locale
locale("es", decimal_mark = ",")
Run the code above in your browser using DataLab