Learn R Programming

oce (version 1.0-1)

write.ctd: Write a CTD Data Object as a CSV File

Description

Writes a comma-separated file containing the data frame stored in the data slot of the first argument. The file is suitable for reading with a spreadsheet, or with read.csv. This output file will contain some of the metadata in x, if metadata is TRUE.

Usage

write.ctd(object, file, metadata = TRUE, flags = TRUE,
  format = "csv")

Arguments

object

A ctd object, i.e. one inheriting from ctd-class.

file

Either a character string (the file name) or a connection. If not provided, file defaults to stdout().

metadata

a logical value indicating whether to put some selected metadata elements at the start of the output file.

flags

a logical value indicating whether to show data-quality flags as well as data.

format

string indicating the format to use. This may be "csv" for a simple CSV format, or "whp" for the World Hydrographic Program format, described at [1] and exemplified at [2].

References

1. https://www.nodc.noaa.gov/woce/woce_v3/wocedata_1/whp/exchange/exchange_format_desc.htm

2. https://www.nodc.noaa.gov/woce/woce_v3/wocedata_1/whp/exchange/example_ct1.csv

See Also

The documentation for ctd-class explains the structure of CTD objects.

Other things related to ctd data: [[,ctd-method, [[<-,ctd-method, as.ctd, cnvName2oceName, ctd-class, ctdDecimate, ctdFindProfiles, ctdRaw, ctdTrim, ctd, handleFlags,ctd-method, initialize,ctd-method, initializeFlagScheme,ctd-method, oceNames2whpNames, oceUnits2whpUnits, plot,ctd-method, plotProfile, plotScan, plotTS, read.ctd.itp, read.ctd.odf, read.ctd.sbe, read.ctd.woce.other, read.ctd.woce, read.ctd, setFlags,ctd-method, subset,ctd-method, summary,ctd-method, woceNames2oceNames, woceUnit2oceUnit

Examples

Run this code
# NOT RUN {
library(oce)
data(ctd)
write.ctd(ctd, "ctd.csv")
d <- read.csv("ctd.csv")
plot(as.ctd(d$salinity, d$temperature, d$pressure))
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab