Learn R Programming

oce (version 0.2-1)

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, debug=FALSE)

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 dataframe. For example, using name="hello" in the creation of d would mean that the data could be accessed as d$data$hello
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.)
debug
Set TRUE to see information about the processing.

Value

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

Details

These functions add the column to the the data frame in the the object.

See Also

See read.ctd for the data format.

Examples

Run this code
library(oce)
data(ctd) 
SS <- ctd$data$salinity^2
ctd.new <- ctdAddColumn(ctd, SS, "ss", 
                          expression(paste(S^2, "[", PSU^2, "]")))
plot.profile(ctd.new, "ss")

Run the code above in your browser using DataLab