Create a copy of an object in which some element of its
data slot has been altered, or added.
oceSetData(object, name, value, unit, originalName, note = "")
an oce object.
String indicating the name of the
Value for the item.
An optional indication of the units for the item. This has three possible forms (see “Details”).
Optional character string giving an 'original' name (e.g. as stored in the header of a data file).
Either empty (the default), a character string, or
An oce object, the
data slot of which has
been altered either by adding a new item or modifying an existing
The trickest argument to set is the
unit. There are three
possibilitis for this:
unit is a named or unnamed
list() that contains two items.
If the list is named, the names must be
scale. If the list is unnamed, the stated names are assigned
to the items, in the stated order. Either way, the
item must be an
expression() that specifies the unit,
scale item must be a string that describes the scale. For
example, modern temperatures have
unit is an
expression() giving the unit as above. In this
case, the scale will be set to
unit is a character string that is converted
into an expression with parse
and the scale set to
data(ctd) Tf <- swTFreeze(ctd) ctd <- oceSetData(ctd, "freezing", Tf, list(unit=expression(degree*C), scale="ITS-90")) feet <- swDepth(ctd) / 0.3048 ctd <- oceSetData(ctd, name="depthInFeet", value=feet, expression("feet")) fathoms <- feet / 6 ctd <- oceSetData(ctd, "depthInFathoms", fathoms, "fathoms")