Learn R Programming

oce (version 1.8-1)

as.unit: 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 = ""))

Value

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

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.

Examples

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

Run the code above in your browser using DataLab