oce.edit {oce}R Documentation

Edit an oce object

Description

Edit an element of a oce object

Usage

oce.edit(x, item, value, action,
         reason="not specified", person="not specified")

Arguments

x a oce object.
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 if supplied, a character string containing R code to carry out some action on the object
reason the reason for the change
person name of person making the change

Details

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.

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.

Value

An object of class "oce", altered appropriately, and with a log item indicating the nature of the alteration.

Author(s)

Dan Kelley

Examples

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")

[Package oce version 0.1-76 Index]