Save VPR data as an as.oce object

vpr_save(data, metadata)

Arguments

data

a VPR data frame

metadata

(optional) a named list of character values giving metadata values. If this argument is not provided user will be prompted for a few generic metadata requirements.

Value

an oce CTD object with all VPR data as well as metadata

Details

This function will pass a VPR data frame object to an oce object. Using an oce object as the default export format for VPR data allows for metadata and data to be kept in the same, space efficient file, and avoid redundancy in the data frame. The function check for data parameters that may actually be metadata parameters (rows which have the same value repeated for every observation). These parameters will automatically be copied into the metadata slot of the oce object. The function will also prompt for a variety of required metadata fields. Depending on specific research / archiving requirements, these metadata parameters could be updated by providing the argument metadata.

Default metadata parameters include 'deploymentType', 'waterDepth', 'serialNumber', 'latitude', 'longitude', 'castDate', 'castStartTime', 'castEndTime', 'processedBy', 'opticalSetting', 'imageVolume', 'comment'.

Examples

data("category_conc_n")
metadata <- c('deploymentType' = 'towyo', 'waterDepth' =
max(ctd_roi_merge$pressure), 'serialNumber' = NA, 'latitude' = 47,
'longitude' = -65, 'castDate' = '2019-08-11', 'castStartTime'= '00:00',
'castEndTime' = '01:00', 'processedBy' = 'E. Chisholm', 'opticalSetting' =
'S2', 'imageVolume' = 83663, 'comment' = 'test data')

oce_dat <- vpr_save(category_conc_n, metadata)
#> [1] "Metadata parameter found in Data object!  station value of test moved to metadata slot. "
# save(oce_dat, file = vpr_save.RData') # save data