This function returns a glider object that holds data as provided
in the data argument, with units as provided by the units
argument. The units argument is optional, making the function
easy to use in interactive sessions, but production code ought to
be written with units fully specified.
Arguments
- type
Character value giving the type of glider, e.g. be either
seaexplorerorslocum.- data
A data frame containing the data. This is copied straight into the
payload1item in thedataslot of the returned value, without name translation. For most functions in this package to work,dataought to have items namedlongitude,latitude,salinity,temperatureandpressure.- units
A list holding units, with names corresponding to the names in the data. See the example for the format to be used for
units, but note that there are several items in this dataset that are not given units, in this example.
Examples
library(oceglider)
directory <- system.file("extdata/sea_explorer/delayed_raw", package = "oceglider")
g <- read.glider.seaexplorer.raw(directory, "pld1.raw", progressBar = FALSE)
data <- g[["data"]]
units <- list(
temperature = list(unit = expression(degree * C), scale = "ITS-90"),
salinity = list(unit = expression(), scale = "PSS-78"),
pressure = list(unit = expression(dbar), scale = ""),
longitude = list(unit = expression(degree * E), scale = ""),
latitude = list(unit = expression(degree * N), scale = "")
)
gg <- as.glider("seaexplorer", data, units)
par(mfrow = c(2, 1))
plot(g, which = "p")
plot(gg, which = "p")