Learn R Programming

oce (version 0.9-18)

ctdAddColumn: Add a column to the data slot of a ctd object

Description

Add a column to the data slot of an object of ctd-class, also updating the metadata slot as appropriate.

Usage

ctdAddColumn(x, column, name, label, unit = NULL,
  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 indication of the unit, in the form of a list containing items unit, which is an expression, and scale, which is a character string. For example, modern measurements of temperature have unit list(name=expression(de
debug
A debugging flag; set this to a positive value to get debugging information during processing.

Value

  • A ctd object.

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) 
F <- 32 + (9/5)*ctd[["temperature"]] 
ctdNew <- ctdAddColumn(ctd, F, "temperatureF", 
    unit=list(unit=expression(degree*F), scale="ITS-90"))

Run the code above in your browser using DataLab