Learn R Programming

ds4psy (version 0.2.1)

what_day: What day (of the week) is it?

Description

what_day provides a satisficing version of to determine the day of the week corresponding to a given date.

Usage

what_day(when = Sys.time(), abbr = FALSE)

Arguments

when

Date (as a scalar or vector). Default: when = NA. Using as.Date(when) to convert strings into dates, and Sys.Date(), if when = NA.

abbr

Boolean: Return abbreviated? Default: abbr = FALSE.

Details

what_day returns the weekday of when or Sys.Date() (as a name).

See Also

what_date() function to obtain dates; what_time() function to obtain times; 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: cur_date(), cur_time(), what_date(), what_month(), what_time(), what_week(), what_year()

Examples

Run this code
# NOT RUN {
what_day()
what_day(abbr = TRUE)

# Work with vectors (when as characters):
ds <- c("2020-01-01", "2020-02-29", "2020-12-24", "2020-12-31")
what_day(when = ds)
what_day(when = ds, abbr = TRUE)

# }

Run the code above in your browser using DataLab