Description Usage Arguments Details Value Examples
View source: R/accessors-day.r
Get/set days component of a date-time
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
x |
a POSIXct, POSIXlt, Date, chron, yearmon, yearqtr, zoo, zooreg, timeDate, xts, its, ti, jul, timeSeries, or fts object. |
label |
logical. Only available for wday. TRUE will display the day of the week as an ordered factor of character strings, such as "Sunday." FALSE will display the day of the week as a number. |
abbr |
logical. Only available for wday. FALSE will display the day of the week as an ordered factor of character strings, such as "Sunday." TRUE will display an abbreviated version of the label, such as "Sun". abbr is disregarded if label = FALSE. |
week_start |
day on which week starts following ISO conventions - 1
means Monday, 7 means Sunday (default). When |
locale |
locale to use for day names. Default to current locale. |
value |
a numeric object |
mday()
and yday()
return the day of the month and day of the
year respectively. day()
and day<-()
are aliases for mday()
and
mday<-()
.
wday()
returns the day of the week as a decimal number or an
ordered factor if label is TRUE
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | x <- as.Date("2009-09-02")
wday(x) #4
wday(ymd(080101))
wday(ymd(080101), label = TRUE, abbr = FALSE)
wday(ymd(080101), label = TRUE, abbr = TRUE)
wday(ymd(080101) + days(-2:4), label = TRUE, abbr = TRUE)
x <- as.Date("2009-09-02")
yday(x) #245
mday(x) #2
yday(x) <- 1 #"2009-01-01"
yday(x) <- 366 #"2010-01-01"
mday(x) > 3
|
Attaching package: 'lubridate'
The following object is masked from 'package:base':
date
[1] 4
[1] 3
[1] Tuesday
7 Levels: Sunday < Monday < Tuesday < Wednesday < Thursday < ... < Saturday
[1] Tues
Levels: Sun < Mon < Tues < Wed < Thurs < Fri < Sat
[1] Sun Mon Tues Wed Thurs Fri Sat
Levels: Sun < Mon < Tues < Wed < Thurs < Fri < Sat
[1] 245
[1] 2
[1] FALSE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.