as.unit: Convert a String to a Unit

View source: R/units.R

as.unitR Documentation

Convert a String to a Unit

Description

This converts strings to unit objects. Only a few strings are recognized, because most oce functions have specialized unit vocabularies and so have little need of this function.

Usage

as.unit(u, default = list(unit = expression(), scale = ""))

Arguments

u

A character string indicating a unit. Case is ignored, so that e.g. "dbar" and "DBAR" yield equal results. The following are recognized: c("m-1", "dbar", "decibar", "degree", "degree_Celcius", "degree_north", "degree_east", "ipts-68", "its-90", "m/s^1", "m/s^2", "pss-78", "umol/kg", "micromole/kg")

default

A default to be used for the return value, if u is not a recognized string.

Value

A list with elements unit, an expression(), and scale, a string.

Author(s)

Dan Kelley

Examples

as.unit("DBAR")
as.unit("IPTS-68")
as.unit("ITS-90")
as.unit("PSS-78")
as.unit("UMOL/KG")


oce documentation built on Sept. 11, 2024, 7:09 p.m.