Description Usage Arguments Examples
ymon_parse() is a parser for turning character input into ymon objects. The
character method for as_ymon() is very strict, and only parses input of the
form "YYYY-MM", erroring on any failures. ymon_parse() is more flexible
and will only issue a warning if parsing fails.
Internally:
"-%d" is appended to the format, and "-01" is appended to x.
An attempt to parse as a Date is then made.
The resulting Date is converted to ymon, with a warning if any input failed
to parse. Failures result in NA.
1 | ymon_parse(x, format = "%Y-%m")
|
x |
A character vector to coerce to ymon. |
format |
A format to parse character input with. Should generally only consist
of format tokens related to year or month. Common formats are |
1 2 3 4 5 | ymon_parse("1970-01")
ymon_parse("1970 Jan", format = "%Y %b")
# Unparseable input results in `NA`, with a warning
try(ymon_parse(c("1970-00", "1970-01")))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.