View source: R/return_k_date.R
return_k_date | R Documentation |
Return the k-th most recent or oldest date / datetime from a vector
return_k_date(x, k, decreasing = TRUE)
x |
A vector of date-time |
k |
Integer specifying the k-th value to return from the vector |
decreasing |
Logical. Specifies whether to return most recent or oldest |
library(lubridate)
dates <- c(ymd("2018-01-01"), ymd("2016-01-31"), ymd("2017-01-31"))
return_k_date(dates, k = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.