get.mondate.displayFormats: get or set the vector of formats to use when converting...

View source: R/mondate.r

get.mondate.displayFormatsR Documentation

get or set the vector of formats to use when converting character to mondate

Description

Methods to access the vector of displayFormats used by default.

Usage

get.mondate.displayFormats()
set.mondate.displayFormats(x, clear = FALSE)

Arguments

x

a character value(s) holding additional formats to be used for converting character to mondate

clear

logical indicating if the current formats should be "cleared" and completely replaced by the value(s) in x. If FALSE, the value(s) in x are appended to the current set.

Value

A vector of formats.

Author(s)

Dan Murphy

Examples

get.mondate.displayFormats()
# Attempting to convert a date given in the French format dd/mm/yyyy actually
# works because the European format %Y/%m/%d successfully translates
# that character string in the same way as.Date translates it.
m <- mondate("31/08/2015")
m
year(m) # 31 .. probably an unreasonable value
d <- as.Date("31/08/2015")
d
year(d)
# Ensure the appropriate format is found first by 
# reprioritizing it in the list
set.mondate.displayFormats(c(Frb = "%d/%m/%Y", get.mondate.displayFormats()), 
                          clear = TRUE)
m <- mondate("31/08/2015")
m
year(m) # 2015

chiefmurph/mondate documentation built on Aug. 29, 2022, 4:13 p.m.