yearweek {grates} | R Documentation |
Constructor for yearweek objects
Description
yearweek()
is a constructor for <grates_yearweek>
objects. These are
weeks whose first day can be specified by the user.
Usage
yearweek(year = integer(), week = integer(), firstday = 1L)
Arguments
year |
Vector representing the year associated with
|
week |
Vector representing the week associated with 'year.
|
firstday |
The day the week starts on from 1 (Monday) to 7 (Sunday). |
Details
For yearweek objects the first week of a "year" is considered to be the first yearweek containing 4 days of the given calendar year. This means that the calendar year will sometimes be different to that of the associated yearweek object.
Value
A <grates_yearweek>
object with subclass corresponding to the first day of
the week they represent (e.g. <grates_yearweek_monday>
).
Note
Internally <grates_yearweek>
objects are stored as the number of weeks
(starting at 0) from the date of the firstday
nearest the Unix Epoch
(1970-01-01). That is, the number of seven day periods from:
- 1969-12-29 for `firstday` equal to 1 (Monday) - 1969-12-30 for `firstday` equal to 2 (Tuesday) - 1969-12-31 for `firstday` equal to 3 (Wednesday) - 1970-01-01 for `firstday` equal to 4 (Thursday) - 1970-01-02 for `firstday` equal to 5 (Friday) - 1970-01-03 for `firstday` equal to 6 (Saturday) - 1970-01-04 for `firstday` equal to 7 (Sunday)
See Also
as_yearweek()
and new_yearweek()
.
Examples
yearweek(year = 2000L, week = 3L)