utHasOrigin {udunits} | R Documentation |
Determines whether the unit has an origin (i.e., defines a scale).
utHasOrigin( unit )
unit |
A unit, in internal format as returned by utScan() or as a human-readable string. |
This routine determines whether a unit has an origin. For example, the unit "days" does not have an origin, but the unit "days since 1900-01-01" does. In particular, a calendar must have an origin as well as being in temporal units.
TRUE if the unit has an origin, and FALSE otherwise.
Library routines by Unidata; interface glue by David W. Pierce dpierce@ucsd.edu
http://www.unidata.ucar.edu/packages/udunits/
utInit
, utScan
,
utCalendar
, utInvCalendar
,
utFormatDate
, utDayOfWeek
, utIsTime
,
utConvert
# Initialize the udunits library utInit() # Test to see if various proposed units would be suitable calendars unitstring <- "days" print(paste("Units",unitstring,"would work as a calendar:", utIsTime(unitstring)&&utHasOrigin(unitstring))) unitstring <- "days since 1980-01-01" print(paste("Units",unitstring,"would work as a calendar:", utIsTime(unitstring)&&utHasOrigin(unitstring)))