| 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 matched
data.
## S4 method for signature 'argo'
handleFlags(object, flags = NULL, actions = NULL,
debug = getOption("oceDebug"))
object |
An object of |
flags |
A |
actions |
An optional |
debug |
An optional integer specifying the degree of debugging, with
value 0 meaning to skip debugging and 1 or higher meaning to print some
information about the arguments and the data. It is usually a good idea to set
this to 1 for initial work with a dataset, to see which flags are being
handled for each data item. If not supplied, this defaults to the value of
|
Dan Kelley
1. http://www.argo.ucsd.edu/Argo_date_guide.html#dmodedata
Other functions relating to data-quality flags: defaultFlags,
handleFlags,adp-method,
handleFlags,ctd-method,
handleFlags,section-method,
handleFlags,
initializeFlagScheme,ctd-method,
initializeFlagScheme,oce-method,
initializeFlagScheme,section-method,
initializeFlagScheme,
initializeFlags,adp-method,
initializeFlags,oce-method,
initializeFlags,
setFlags,adp-method,
setFlags,ctd-method,
setFlags,oce-method, setFlags
Other things related to argo data: [[,argo-method,
[[<-,argo-method, argo-class,
argoGrid, argoNames2oceNames,
argo, as.argo,
plot,argo-method, read.argo,
subset,argo-method,
summary,argo-method
library(oce)
data(argo)
# 1. Default: set to NA any data that is not flagged with
# code value 1 (meaning \code{"passed_all_tests"})
argoNew <- handleFlags(argo, flags=c(0, 2:9))
# Demonstrate replacement, looking at the second profile
f <- argo[["salinityFlag"]][,2] # first column with a flag=4 entry
df <- data.frame(flag=f, orig=argo[["salinity"]][,2], new=argoNew[["salinity"]][,2])
df[11:15,] # notice line 13
# 2. A less restrictive case: focussing just on salinity,
# retain only data with flags 1 (meaning \code{"passed_all_tests"})
# and 2 (\code{"probably_good"}).
argoNew <- handleFlags(argo, flags=list(salinity=c(0, 3:9)))