Learn R Programming

oce (version 0.9-18)

oceAddData: Access or Alter Data or Metadata Within an oce Object

Description

Add, alter, get, or delete data or metadata items.

Usage

oceGetData(object, name, default=NA)
oceDeleteData(object, name)
oceSetData(object, name, value, units, note="")
oceGetMetadata(object, name, default=NA)
oceDeleteMetadata(object, name)
oceSetMetadata(object, name, value, note="")

Arguments

object
An oce object.
name
Name of the desired item.
value
Value for the named item.
units
Optional list containing unit, an expression specifying the unit and scale, a character string specifying the scale. The
default
A default value to be returned if name is not found.
note
A note to be inserted in the processing log, in addition to an automatically-constructed note.

Value

  • For set and delete functions, the updated object is returned. For the get functions, the named item is returned.

Details

In providing access to the data and metadata slots of an object, these functions are similar to direct access, e.g. in x <- oceSetMetadata(x, "latitude", 45) x@metadata$latitude <- 45 the first has the advantage of adding useful notes to the processingLog. The delete functions also update the log.

Examples

Run this code
library(oce)
data("ctd")
oceGetMetadata(ctd, "latitude")
ctd <- oceSetMetadata(ctd, "latitude", 45, "We like round numbers")
summary(ctd)

Run the code above in your browser using DataLab