Description Usage Arguments Details Value Examples
This function takes a vector of Date objects and calculates the week and year according to ISO 8601. It is flexible in its output.
1 2 |
x |
A vector of class |
type |
A string (one of "week", "year", "both_text", "both_num" or "matrix") that determines the kind of output the function returns. See "Return value". |
sep |
Seperator between year and week, applicable if |
inv |
If |
colnames |
Names for the matrix columns if |
This function calculates the week number according to ISO 8601. Note that dates near the start or end of a given year may belong to the previous or next year respectively, thus the year needs to be calculated too.
Different according to the function's type argument. If
"both_num" (the default), a vector of 6-digit integers is returned, in a
YYYYWW format. If "week" or "year", only the week number or year is
returned, respectively. If "both_text", then a character vector of the same
length as x is returned, containing both the year and week number, seperated
by sep, and inverted if inv=TRUE. Finally, if type="matix", both
year and week numbers are returned in a two-column matrix, with the columns named as
in colnames.
1 2 3 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.