ud.is.parseable: Determine whether a unit string is parseable by the udunits...

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/ud.functions.R

Description

Determine whether a unit string is parseable and recognized by the udunits library.

Usage

1
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

ud.are.convertible

Examples

1
2
3
4
ud.is.parseable("K")             # TRUE
ud.is.parseable("  K  ")         # TRUE
ud.is.parseable("miles")         # TRUE
ud.is.parseable("Not parseable") # FALSE

pacificclimate/Rudunits2 documentation built on Feb. 20, 2022, 4:25 p.m.