| timeunits-methods {mondate} | R Documentation |
Methods to get and set the timeunits value of a mondate.
## S4 method for signature 'mondate' timeunits(x) ## S4 method for signature 'ANY' timeunits(x) ## S4 replacement method for signature 'mondate' timeunits(x)<-value ## S4 method for signature 'mondate' mondateTimeunits(x) ## S4 method for signature 'ANY' mondateTimeunits(x) ## S4 replacement method for signature 'mondate' mondateTimeunits(x)<-value
x |
a |
value |
For the "get" method,
a
If |
The mondateTimeunits versions are being deprecated.
x<-mondate("2010-6-30") # The middle of 2010
mondateTimeunits(x) # "months"
y<-x+12 # One year (12 months) later.
mondateTimeunits(y) # "months"
y-x # Result is 12 months
mondateTimeunits(y) <- "years"
y-x # Result is 1 year, with a warning because
# x@timeunits != y@timeunits. Units of result
# comes from the first argument.
mondateTimeunits(y) <- "days"
suppressWarnings(y-x) # Result is 365 days -- warning suppressed