as.oce {oce} | R Documentation |
Coerce Something Into an oce Object
Description
Coerce Something Into an oce Object
Usage
as.oce(x, ...)
Arguments
x |
an item containing data. This may be data frame, list, or an oce object. |
... |
optional extra arguments, passed to conversion functions
|
Details
This function is limited and not intended for common use.
In most circumstances, users should employ a function such
as as.ctd()
to construct specialized oce sub-classes.
as.oce
creates an oce object from data contained within its
first argument, which may be a list, a data frame, or an object
of oce. (In the last case, x
is
simply returned, without modification.)
If x
is a list containing items named longitude
and
latitude
, then as.coastline()
is called (with
the specified ... value) to create a coastline object.
If x
is a list created by read_odf()
from the (as
yet unreleased) ODF package developed by the Bedford Institute of
Oceanography, then ODF2oce()
is called (with
no arguments other than the first) to calculate a return value.
If the sub-class inference made by ODF2oce()
is
incorrect, users should call that function directly, specifying
a value for its coerce
argument.
If x
has not been created by read_odf()
, then the names
of the items it contains are examined, and used to try to infer
the proper return value. There
are only a few cases (although more may be added if there is
sufficient user demand). The cases are as follows.
If
x
contains items namedtemperature
,pressure
and eithersalinity
orconductivity
, then an object of type ctd will be returned.If
x
contains columns namedlongitude
andlatitude
, but no other columns, then an object of class coastline is returned.
Value
An oce object.