oceSetData | R Documentation |
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 = "")
object |
an oce object. |
name |
the name of the |
value |
value for the item. |
unit |
an optional indication of the units for the item. This has three possible forms (see “Details”). |
originalName |
character string giving an 'original' name (e.g.
as stored in the header of a data file). The default, |
note |
either empty (the default), a character string, or |
The trickiest argument to set is the unit
. There are three
possibilities for this:
unit
is a named or unnamed list()
that contains two items.
If the list is named, the names must be
unit
and scale
. If the list is unnamed, the stated names are assigned
to the items, in the stated order. Either way, the unit
item must be an expression()
that specifies the unit,
and the scale
item must be a string that describes the scale. For
example, modern temperatures have
unit=list(unit=expression(degree*C), scale="ITS-90")
.
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(text=unit)
,
and the scale set to ""
.
oceSetData
returns an oce object, the data
slot of which
has been altered either by adding a new item or modifying an existing item.
Dan Kelley
Other things related to the data slot:
oceDeleteData()
,
oceGetData()
,
oceRenameData()
data(ctd)
Tf <- swTFreeze(ctd)
ctd <- oceSetData(ctd, "freezing", Tf,
unit = list(unit = expression(degree * C), scale = "ITS-90")
)
plotProfile(ctd, "freezing")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.