fast_as_idate {grattanInflators}R Documentation

Faster conversion to IDate for common dates

Description

Faster conversion to IDate for common dates

Usage

fast_as_idate(
  x,
  incl_day = TRUE,
  check = 0L,
  nThread = 1L,
  format = "%Y-%m-%d"
)

Arguments

x

The character vector to convert, in YYYY-mm-dd form only.

incl_day

Whether or not the day is necessary to convert. Set to FALSE when the day component does not matter (or is constantly -01); the day component in the output will be -01.

check

integer: 0, 1, or 2 Level of check to perform. 0 for no checks.

nThread

Number of threads to use.

format

The expected format of the input.

Details

A 10M vector of dates was observed to be parsed in 0.1s whereas as.IDate took 9.0s, and lubridate::ymd, 1.6s. Note that false dates (such as Feb 30) will be naively parsed without warning or error (unless 'check' is changed from its default argument).

Value

A vector of class IDate, Date the same length as x.

Examples

# For ABS data, we only need to care (and check)
# the year and month
fast_as_idate("2015-12-13", incl_day = FALSE)


[Package grattanInflators version 0.5.3 Index]