ctd.add.column {oce} | R Documentation |
Add a column to a ctd
file, updating the header as appropriate.
ctd.add.column(x, column=NULL, column.name="", code="", name="", unit="", debug=FALSE)
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. |
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.
An object of class
"ctd"
, with a new column.
Dan Kelley
The Seabird CTD instrument is described at http://www.seabird.com/products/spec_sheets/19plusdata.htm.
See read.ctd
for the data format.
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");