Learn R Programming

oce (version 0.9-3)

ctdAddColumn: Add a column to a CTD file

Description

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

Usage

ctdAddColumn(x, column, name, label, unit, debug=getOption("oceDebug"))

Arguments

x
A ctd object, e.g. as read by read.ctd.
column
A column of data to be inserted, in the form of a numeric vector, whose length matches that of columns in the objecct.
name
Character string indicating the name this column is to have in the data slot of x.
label
Optional character string or expression indicating the name of the column, as it will appear in plot labels. (If not given, name will be used.)
unit
Optional character string indicating unit.
debug
set to a positive value to get debugging information during processing.

Value

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

Details

This function adds a column to the object's data slot.

See Also

The documentation for ctd-class explains the structure of CTD objects, and also outlines the other functions dealing with them.

Examples

Run this code
library(oce)
data(ctd) 
SS <- ctd[["salinity"]]^2
ctdNew <- ctdAddColumn(ctd, SS, "ss", 
                        expression(paste(S^2, "[", PSU^2, "]")))
plotProfile(ctdNew, "ss")

Run the code above in your browser using DataLab