yq {dint}R Documentation

Parse Dates With Year and Quarter Components

Description

These are generic parsers for year/quarter/month formats that work with nearly all possible year/quarter formats. The only prerequisite is that x contains a 4-digit-year and a 1-digit-quarter or 2-digit-month and no additional numbers.

Usage

yq(x, quiet = FALSE)

qy(x, quiet = FALSE)

ym(x, quiet = FALSE)

my(x, quiet = FALSE)

Arguments

x

a character vector

quiet

a logical scalar. If TRUE warnings on parsing failures are suppressed.

Value

a date_yq or date_ym vector

Examples

yq("2018 1")
qy("1st Quarter 2019")

#' # Works even for filenames, as long as they contain no additional numbers
yq("business_report-2018_1.pdf")
my("business_report-082018.pdf")

[Package dint version 2.1.3 Index]