seq_month_ofeach_day | R Documentation |
The sequence of month numbers for each day in the period from - to
seq_month_ofeach_day(
from = list(year = 1900, month = 1, day = 1),
to = list(year = 1900, month = 12, day = 31),
tz = "UTC"
)
from |
A list with three elements |
to |
A list with three elements |
tz |
a character string. The time zone specification to be used
for the conversion, if one is required. System-specific (see
time zones), but |
as.POSIXlt
, seq.POSIXt
## Not run:
month1 <- function() {
as.POSIXlt(seq(
from = ISOdate(1980, 1, 1, tz = "UTC"),
to = ISOdate(2010, 12, 31, tz = "UTC"), by = "1 day"
))$mon + 1
}
month2 <- function() {
seq_month_ofeach_day(
from = list(1980, 1, 1),
to = list(2010, 12, 31),
tz = "UTC"
)
}
if (requireNamespace("microbenchmark", quietly = TRUE)) {
# barely any difference
microbenchmark::microbenchmark(month1(), month2())
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.