what_week | R Documentation |
what_week
provides a satisficing version of
to determine the week corresponding to a given date.
what_week(when = Sys.Date(), unit = "year", as_integer = FALSE)
when |
Date (as a scalar or vector).
Default: |
unit |
Character: Unit of week?
Possible values are |
as_integer |
Boolean: Return as integer?
Default: |
what_week
returns the week
of when
or Sys.Date()
(as a name or number).
what_wday()
function to obtain (week)days;
what_date()
function to obtain dates;
cur_time()
function to print the current time;
cur_date()
function to print the current date;
now()
function of the lubridate package;
Sys.time()
function of base R.
Other date and time functions:
change_time()
,
change_tz()
,
cur_date()
,
cur_time()
,
days_in_month()
,
diff_dates()
,
diff_times()
,
diff_tz()
,
is_leap_year()
,
what_date()
,
what_month()
,
what_time()
,
what_wday()
,
what_year()
,
zodiac()
what_week()
what_week(as_integer = TRUE)
# Other dates/times:
d1 <- as.Date("2020-12-24")
what_week(when = d1, unit = "year")
what_week(when = d1, unit = "month")
what_week(Sys.time()) # with POSIXct time
# with date vector (as characters):
ds <- c("2020-01-01", "2020-02-29", "2020-12-24", "2020-12-31")
what_week(when = ds)
what_week(when = ds, unit = "month", as_integer = TRUE)
what_week(when = ds, unit = "year", as_integer = TRUE)
# with time vector (strings of POSIXct times):
ts <- c("2020-12-25 10:11:12 CET", "2020-12-31 23:59:59")
what_week(ts)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.