Learn R Programming

readr (version 0.2.2)

locale: Create locales

Description

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.

Usage

locale(date_names = "en", date_format = "%Y%.%m%.%d", time_format = "%H:%M", decimal_mark = ".", grouping_mark = NULL, tz = "UTC", encoding = "UTF-8", asciify = FALSE)
default_locale()

Arguments

date_names
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.
date_format, time_format
Default date and time formats.
decimal_mark, grouping_mark
Symbols used to indicate the decimal place, and to chunk larger numbers. Decimal mark can only be , or ..
tz
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 absense 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.

encoding
Default encoding. This only affects how the file is read - readr always converts the output to UTF-8.
asciify
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.

Examples

Run this code
locale()
locale("fr")

# South American locale
locale("es", decimal_mark = ",")

Run the code above in your browser using DataLab