as.section {oce} | R Documentation

## Create a section

### Description

Create a section based on columnar data, or a set of `oce-class` objects that can be coerced to CTD form with `as.ctd`.

### Usage

    as.section(salinity, temperature, pressure, longitude, latitude, station,
      sectionId="")

### Arguments

`salinity` | This may be a numerical vector, in which case it is interpreted as the salinity, and the other arguments are used for the other components of `ctd-class` objects. Alternatively, it may be one of a variety of other objects from which the CTD objects can be inferred, in which case the other arguments are ignored; see ‘Details’.
`temperature` | Temperature, in a vector holding values for all stations.
`pressure` | Pressure, in a vector holding values for all stations.
`longitude` | Longitude, in a vector holding values for all stations.
`latitude` | Latitude, in a vector holding values for all stations.
`station` | Station identifiers, in a vector holding values for all stations.
`sectionId` | section identifier.

### Details

If the first argument is a numerical vector, then it is taken to be the salinity, and `factor` is applied to `station` to break the data up into chunks that are assembled into `ctd-class` objects with `as.ctd` and combined to make a `section-class` object to be returned. This mode of operation is provided as a convenience for datasets that are already partly processed; if original CTD data are available, the next mode is preferred, because it permits the storage of much more data and metadata in the CTD object.

If the first argument is a list containing oce objects that can be coerced into CTD form with `as.ctd` – or a character vector containing the names of such objects that are defined in the calling environment – then those objects are combined to form the station, and all other arguments are ignored. This is the best way to call `as.section`.

If the first argument is a `argo-class` object, then the profiles it contains are turned into `ctd-class` object, and these are assembled into a section to be returned.

### Value

An object of `class` `"section"`.

### Author(s)

Dan Kelley

### See Also

The documentation for `section-class` explains the structure of section objects, and outlines other functions dealing with them.

### Examples

    library(oce)
    data(ctd)
    ## vector of names of CTD objects
    fake <- ctd
    fake[["temperature"]] <- ctd[["temperature"]] + 0.5
    fake[["salinity"]] <- ctd[["salinity"]] + 0.1
    fake[["longitude"]] <- ctd[["longitude"]] + 0.01
    fake[["station"]] <- "fake"
    sec1 <- as.section(c("ctd", "fake"))
    summary(sec1)
    ## vector of CTD objects
    ctds <- vector("list", 2)
    ctds[[1]] <- ctd
    ctds[[2]] <- fake
    sec2 <- as.section(ctds)
    summary(sec2)
    ## argo data (a subset)
    data(argo)
    sec3 <- as.section(subset(argo, profile<5))
    summary(sec3)

[Package oce version 0.9-18 Index]