ctd.add.column {oce}R Documentation

Add a column to a CTD file

Description

Add a column to a ctd file, updating the header as appropriate.

Usage

ctd.add.column(x, column=NULL, column.name="", code="", name="", unit="", 
               debug=FALSE)

Arguments

x A ctd object, e.g. as read by read.ctd.
column A column of data.
column.name The name for this column in the dataframe; e.g. if set to hello, then the column would be accessed later d$data$hello.
code Item to put before the : in the header line.
name Item to put after the :, but before the [].
unit Item inside the [] in the header line.
debug Set TRUE to see information about the processing.

Details

This adds a line of the form

* name N = code: name [unit]
within the header list, and also adds the data column itself. You should study an existing .cnv file to see what sort of format to use, to avoid confusion if you share the resultant file.

Value

An object of class "ctd", with a new column.

Author(s)

Dan Kelley

References

The Seabird CTD instrument is described at http://www.seabird.com/products/spec_sheets/19plusdata.htm.

See Also

See read.ctd for the data format.

Examples

library(oce)
data(ctd) 
sigthe <- sw.sigma.theta(ctd$data$salinity,
        ctd$data$temperature,
        ctd$data$pressure);
ctd.new <- ctd.add.column(ctd,
        sigthe, "sigmatheta",
        "sigma-theta", "density, sigma-theta",
        "kg/m^3");

[Package oce version 0.1-76 Index]