| handleFlags,argo-method {oce} | R Documentation |
Data-quality flags are stored in the metadata
slot of oce-class objects in a
list named flags.
The present function (a generic that has specialized versions
for various data classes) provides a way to
manipulate the core data based on
the data-quality flags. For example, a common operation is to replace suspicious
or erroneous data with NA.
If metadata$flags in the object supplied as the first argument
is empty, then that object is returned, unaltered.
Otherwise, handleFlags analyses the data-quality flags within
the object, in relation to the flags argument, and interprets
the action argument to select an action to be applied to mached
data.
Reasonable defaults are used if flags and actions
are not supplied (see ‘Details’),
but different schemes are used in different
data archives, so it is risky to rely on these defaults.
It is usually necessary to tailor flags and actions
to the data and the analysis goals.
## S4 method for signature 'argo' handleFlags(object, flags = list(), actions = list())
object |
An object of |
flags |
An optional |
actions |
An optional |
If flags and actions are not provided, the
default is to use ARGO flags [1], in which the
value 1 indicates good data, and other values indicate either unchecked,
suspicious, or bad data. Any data not flagged as good are set
to NA in the returned value. Since Argo flag codes run
from 0 to 4, this default is equivalent to
setting flags=list(c(0, 2:4)) along with
actions=list("NA").
handleFlags is a new function as of March 2016,
and it will probably continue to evolve through the rest of 2016.
Users are asked to be patient, and to provide help by
looking at the documentation and telling the developers
whether the planned functioning seems reasonable.
1. http://www.argo.ucsd.edu/Argo_date_guide.html#dmodedata
Other functions that handle data-quality flags: handleFlags,ctd-method,
handleFlags,section-method,
handleFlags
Other things related to argo data: [[,argo-method,
[[<-,argo-method, argo-class,
argoGrid, argo,
as.argo, plot,argo-method,
read.argo,
subset,argo-method,
summary,argo-method
## Not run: library(oce) data(argo) # 1. Default: anything not flagged as 1 is set to NA, to focus # solely on 'good', in the Argo scheme. argoNew <- handleFlags(argo) # 2. A less restrictive case: include also 'questionable' data, # and only apply this action to salinity. argoNew <- handleFlags(argo, flags=list(salinity=4)) ## End(Not run)