oceAddData {oce} | R Documentation

## 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 `scale` may be an empty string in many cases, e.g. for pressure. For example, for a temperature measured on the modern scale, `units` could be `list(unit=expression(degree*C), scale="ITS-90")`.
`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.

### 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.

### Value

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

### Examples

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

[Package oce version 0.9-18 Index]