ud.is.parseable {udunits2} | R Documentation |
Determine whether a unit string is parseable by the udunits library
Description
Determine whether a unit string is parseable and recognized by the udunits library.
Usage
ud.is.parseable(unit.string)
Arguments
unit.string |
A character string representing a type of units which may be parseable by the udunits library |
Details
ud.is.parseable
uses udunit's function ut_parse
to
determine whether or not the given unit string is parseable. If
ut_parse
returns NULL, then ud.is.parseable
will return FALSE
.
Value
Returns a logical: True
if the units is parseable and
recognized by the udunits library, False
otherwise.
Note
There is a note in the ut_parse
docs about how the
argument string must have no leading or trailing whitespace. We make
sure in this package to always call ut_trim
on any strings
before they are passed to ut_parse
. The package user need not
strip whitespace before-hand.
Author(s)
James Hiebert hiebert@uvic.ca
References
Unidata's udunits reference: https://www.unidata.ucar.edu/software/udunits/ API guide for ut_parse: https://www.unidata.ucar.edu/software/udunits/udunits-2.1.24/udunits2lib.html#index-ut_005fparse-43
See Also
Examples
ud.is.parseable("K") # TRUE
ud.is.parseable(" K ") # TRUE
ud.is.parseable("miles") # TRUE
ud.is.parseable("Not parseable") # FALSE