View source: R/Data_handling.R
combn_QC | R Documentation |
Combine quality checking results depending on whether they have a fixed or
cumulative effect or any combination of these effects. It is also checked how
should NA
s be interpreted.
combn_QC(
x,
qc_names,
name_out = "-",
additive = NULL,
na.as = NULL,
additive_pattern = "interdep$|wresid$",
na.as_0_pattern = "spikesLF$|fetch70$|man$",
no_messages = FALSE
)
x |
A data frame with column names. |
qc_names |
A vector of names of data frame |
name_out |
A character string providing |
additive |
|
na.as |
|
additive_pattern |
A character string. A |
na.as_0_pattern |
A character string. A |
no_messages |
A logical value. |
The quality checking results to combine must be provided as columns of a data
frame x
, optionally with any number of further columns that will be
ignored. Columns specified by qc_names
will be further separated
according to their additivity. For flags with fixed effect (additive =
FALSE
; the most typical type), maximum is taken over each row. For flags
with additive effect (additive = TRUE
), sum is taken over each row. In
case both types of flags are present, results for both groups are summed
together.
The most typical value of argument na.as
is NA
. NA
value
does not suggest any change in interpretation (value of variable
corresponding to this flag will be removed within quality checking scheme).
Exceptionally, value 0
can be used in case that the NA
flag of
the quality checking test/filter is an expected result and means that the
half-hour was not checked by the given test/filter (e.g.
despikeLF
).
An integer vector with attributes varnames
and units
is
produced. varnames
value is set by name_out
argument. Default
value of varnames
and units
is set to "-"
.
Default values for additive
and
na.as
arguments are FALSE
and NA
, respectively. In
case that additive_pattern
is found within qc_names
(i.e.
qc_names
ending with "interdep"
or "wresid"
pattern),
respective values of additive
are changed to TRUE
. This is
because interdep
and wresid (see extract_QC
)
quality control checks are defined as additive within the current quality
control scheme. If na.as_0_pattern
is detected within
qc_names
(i.e. qc_names
ending with "spikesLF"
,
"fetch70"
or "man"
pattern), respective values of
na.as
are changed to 0
(see despikeLF
).
summary_QC
.
set.seed(5)
aa <- data.frame(xx = sample(c(0:2, NA), 20, replace = TRUE))
aa$yy <- sample(c(0:2, NA), 20, replace = TRUE)
aa$add_F <- combn_QC(aa, qc_names = c("xx", "yy"), additive = FALSE,
name_out = "add_F")
aa$add_T <- combn_QC(aa, qc_names = c("xx", "yy"), additive = TRUE,
name_out = "add_T")
aa$add_F_na.as_0 <- combn_QC(aa, qc_names = c("xx", "yy"), additive = FALSE,
na.as = 0, name_out = "add_F_na.as_0")
aa$add_F_na.as_0part <- combn_QC(aa, qc_names = c("xx", "yy"),
additive = FALSE, na.as = c(0, NA), name_out = "add_F_na.as_0part")
aa$add_F_na.as_2 <- combn_QC(aa, qc_names = c("xx", "yy"), additive = FALSE,
na.as = 2, name_out = "add_F_na.as_2")
str(aa)
aa
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.