| as_years_datey | R Documentation |
datey to calendar years (including fractional part)Converts a datey to calendar years,
including a fractional part that represents the
proportion of the calendar year that has elapsed.
For example, the middle of 2000-10-01 is precisely three-quarters through
the (leap) year 2000 and so as.double(mid_day(2000,10,1)) results in
2000.75.
as.numeric() is the same as as.double().
as.integer() gives the calendar year as an integer, e.g.
as.integer(datey(2000.75)) is 2000.
It is also the case that if x is a datey then
as.integer(x) is the same as as.integer(as.double(x)).
## S3 method for class 'datey'
as.double(x, ...)
## S3 method for class 'datey'
as.integer(x, ...)
x |
The |
... |
Not used. |
A vector of double.
datey, as_years_durationy, ops
t <- datey(2000.75)
t # 2000-10-01.5
as.double(t) # 2000.75
as.numeric(t) # 2000.75
as.integer(t) # 2000
identical(as.integer(t), 2000L) # TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.