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.
"handleFlags"(object, flags = list(), actions = list())section-class.list containing (a)
items with names of entries in the data slot of object,
or (b) a single unnamed item. In the first case, the attention is
focussed on the named items, while in the second case the
all the data in the object's data slot are examined.
Each element in the list must be set to an integer or vector of integers,
specifying conditions to be met before actions are to be taken.list that contains items with
names that match those in the flags argument. If actions
is not supplied, the default will be to set all values identified by
flags to NA; this can also be specified by
specifying actions=list("NA"). It is also possible to specify
functions that calculate replacement values. These are provided
with object as the single argument, and must return a
replacement for the data item in question.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.flags and actions are not provided, the
default is to use WHP (World Hydrographic Program) flags [1], in which the
value 2 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 WHP flag codes run
from 1 to 9, this default is equivalent to
setting flags=list(all=c(1, 3:9)) along with
action=list("NA").
handleFlags,argo-method,
handleFlags,ctd-method,
handleFlagsOther things related to section data: [[,section-method,
[[<-,section-method,
as.section,
plot,section-method,
read.section, section-class,
sectionAddStation,
sectionGrid, sectionSmooth,
sectionSort, section,
subset,section-method,
summary,section-method
library(oce)
data(section)
section2 <- handleFlags(section)
par(mfrow=c(2,1))
plotTS(section)
plotTS(section2)
Run the code above in your browser using DataLab