| ymd {tis} | R Documentation |
Extract parts of various Date-Time Objects
Description
Extract the year, month or day, or all three (in yyyymmdd
form), or the quarter, from a jul, ti, or from any object that
jul() can handle.
Usage
ymd(x, ...)
## S3 method for class 'jul'
ymd(x, ...)
## S3 method for class 'ssDate'
ymd(x, ...)
## S3 method for class 'ti'
ymd(x, offset = 1, ...)
## Default S3 method:
ymd(x, ...)
year(x, ...)
quarter(x, ...)
month(x, ...)
day(x, ...)
Arguments
x |
a |
... |
other args to be passed to the method called by the generic
function. |
offset |
for |
Details
year, quarter, month and day call
ymd, and thus understand the same arguments as it does. The
default implementation ymd.default passes it's arguments to a
call to the function jul, so all of these functions work the
same way that function does.
Value
ymd and it's variants return numeric objects in yyyymmdd form.
year, quarter, month and day return
numeric objects.
ymd() with no arguments returns today's yyyymmdd.
See Also
Examples
ymd() ## today's date and time
weekFromNow <- ymd(today() + 7) ## today() returns a daily ti
year(jul(today()))
month(Sys.time())
## create a monthly tis (Time Indexed Series)
aTis <- tis(0, start = c(2000, 1), end = c(2004, 12), freq = 12)
ymd(ti(aTis)) ## the yyyymmdd dates of the observations