Description Usage Arguments Value Note Examples
standardize date classes
1 2 3 4 5 | .date_convert(x, format, origin)
date_convert(x, format = NULL, origin = "1970-01-01")
date_expansion(start_date, end_date, types = c("qtr", "mon", "fy"))
|
x |
A character vector of dates. |
format |
The format of the incoming date. |
origin |
The origin (day 1) for the date. |
start_date |
The start date for date_expansion, must become a date if not already one via date_convert function. |
end_date |
The end date for date_expansion, must become a date if not already one via date_convert function. |
types |
A character vector defining which types to be returned. Choices are any combination of c("fy", "qtr", "mon"). Default is all. |
A vector of dates of class 'Date'.
.date_convert could be moved to C++. lapply() loses the class 'Date', perhapse a better method exists. Also, today: use S3 methods instead of a switch statement.
1 2 3 4 5 6 7 8 9 10 11 12 | date_convert(x = c("10/1/2015", "10/2/2015"))
date_convert(x = factor("10/1/2015"))
x <- factor(c("10/1/2014", "10/2/2015", "10/1/2014", NA))
date_convert(x)
x <- c("10/1/2014", "10/2/2015", "10/1/2014", NA)
date_convert(x)
x <- as.Date("10/1/2014", format = "%m/%d/%Y")
date_convert(x)
x <- as.POSIXct(c("2014-10-1", "2015-10-2", NA))
date_convert(x)
date_convert(x = as.Date("2014-10-1"))
date_expansion(start_date = "10/1/2014", end_date = "9/30/2015")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.