[[<-,ctd-method {oce} | R Documentation

## Replace Parts of a CTD Object

### Description

The `[[<-` method works for all `oce` objects, i.e. objects inheriting from `oce-class`. The purpose, as with the related extraction method, `[[`, is to insulate users from the internal details of `oce` objects, by looking for items within the various storage slots of the object. Items not actually stored can also be replaced, including units and data-quality flags.

### Usage

    ## S4 replacement method for signature 'ctd'
    x[[i, j, ...]] <- value

### Arguments

`x` | A `ctd` object, i.e. one inheriting from `ctd-class`.
`i` | The item to replace.
`j` | Optional additional information on the `i` item.
`...` | Optional additional information (ignored).
`value` | The value to be placed into `x`, somewhere.

### Details

As with `[[` method, the procedure works in steps.

First, the `metadata` slot of `x` is checked to see whether it contains something named with `i`. If so, then the named item is replaced with `value`.

Otherwise, if the string value of `i` ends in `Unit`, then the characters preceding that are taken as the name of a variable, and the `metadata` slot of `x` is updated to store that unit, e.g.

        x[["temperatureUnits"]] <- list(unit=expression(degree*F),scale="")

Similarly, if `i` ends in `Flag`, then quality-control flags are set up as defined by `result`, e.g.

        x[["temperatureFlags"]] <- c(2,4,2,2)

Otherwise, a partial string match is sought among the names of items in the `data` slot of `x`. (This is done with `pmatch`.) The first item found (if any) is then updated to hold the value `result`.

If none of these conditions is met, a warning is issued.

### See Also

Other functions that replace parts of `oce` objects: `[[<-,adp-method`, `[[<-,amsr-method`, `[[<-,argo-method`, `[[<-,bremen-method`, `[[<-,cm-method`, `[[<-,coastline-method`, `[[<-,echosounder-method`, `[[<-,g1sst-method`, `[[<-,gps-method`, `[[<-,lisst-method`, `[[<-,lobo-method`, `[[<-,met-method`, `[[<-,oce-method`, `[[<-,odf-method`, `[[<-,rsk-method`, `[[<-,sealevel-method`, `[[<-,section-method`, `[[<-,tidem-method`, `[[<-,topo-method`, `[[<-,windrose-method`

Other things related to `ctd` data: `[[,ctd-method`, `as.ctd`, `cnvName2oceName`, `ctd-class`, `ctdDecimate`, `ctdFindProfiles`, `ctdRaw`, `ctdTrim`, `ctd`, `handleFlags,ctd-method`, `oceNames2whpNames`, `oceUnits2whpUnits`, `plot,ctd-method`, `plotProfile`, `plotScan`, `plotTS`, `read.ctd.itp`, `read.ctd.odf`, `read.ctd.sbe`, `read.ctd.woce.other`, `read.ctd.woce`, `read.ctd`, `subset,ctd-method`, `summary,ctd-method`, `woceNames2oceNames`, `woceUnit2oceUnit`, `write.ctd`

### Examples

    data(ctd)
    summary(ctd)
    # Move the CTD profile a nautical mile north.
    ctd[["latitude"]] <- 1/60 + ctd[["latitude"]] # acts in metadata
    # Increase the salinity by 0.01.
    ctd[["salinity"]] <- 0.01 + ctd[["salinity"]] # acts in data
    summary(ctd)

[Package oce version 0.9-22 Index]