oce.edit {oce} | R Documentation |
Edit an element of a oce object
oce.edit(x, item, value, action, reason="", person="", debug=getOption("oceDebug"))
x |
an |
item |
if supplied, a character string naming an item in the object's metadata (see “Details”). |
value |
new value for item, if both supplied. |
action |
optional character string containing R code to carry out some action on the object. |
reason |
character string giving the reason for the change. |
person |
character string giving the name of person making the change. |
debug |
an integer that specifies a level of debugging, with 0 or less indicating no debugging, and 1 or more indicating debugging. |
There are two ways to use this function.
1. If both an item
and value
are supplied, then the
object's metadata entry named item
is updated to the
supplied value
.
2. If item
and value
are not supplied, then
action
must be supplied. This is a character string specifying
some action to be performed on the object, e.g. a manipulation of a
column. The action must refer to the object as x
; see
Examples.
3. Applied to an adv
object (i.e. data from an acoustic
velocimeter), oce.edit
treats items named heading
,
pitch
, roll
appropriately, depending on the type of
adv
instrument used. (This is necessary because different
manufacturers produce different forms of these items, i.e. Nortek
reports them on a time base that is different from the velocity
reporting, while Sontek reports them on the same time base.)
In each case, a log entry is stored in the object, to document the
change. Indeed, this is the main benefit to using this function,
instead of altering the object directly. The log entry will be most
useful if it contains a brief note on the reason
for the
change, and the name of the person
doing the work.
An object of class
"oce"
, altered
appropriately, and with a log item indicating the nature of the
alteration.
Dan Kelley
library(oce) data(ctd) ctd2 <- oce.edit(ctd, item="latitude", value=47.8879, reason="illustration", person="Dan Kelley") ctd3 <- oce.edit(ctd,action="x@data$pressure<-x@data$pressure-1")