Learn R Programming

oce (version 1.7-10)

unitFromString: Decode units, from strings

Description

This is mainly intended for internal use within the package, e.g. by read.odf(), and so the list of string-to-unit mappings is not documented, since developers can learn it from simple examination of the code. The focus of unitFromString() is on strings that are found in oceanographic files available to the author, not on all possible units.

Usage

unitFromString(unit, scale = NULL)

Value

A list() of two items: unit which is an expression(), and scale, which is a string.

Arguments

unit

a character value indicating the unit. These are matched according to rules developed to work with actual data files, and so the list is not by any means exhaustive.

scale

a character value indicating the scale. The default value of NULL dictates that the scale is to be inferred from the unit. If a non-NULL value is supplied, it will be used, even if it makes no sense in relation to value of unit.

See Also

Other functions that interpret variable names and units from headers: ODFNames2oceNames(), cnvName2oceName(), oceNames2whpNames(), oceUnits2whpUnits(), unitFromStringRsk(), woceNames2oceNames(), woceUnit2oceUnit()

Examples

Run this code
unitFromString("dbar")   # dbar (no scale)
unitFromString("deg c")  # modern temperature (ITS-90 scale)

Run the code above in your browser using DataLab