apply_QC: Apply Quality Control

View source: R/Quality_checking.R

apply_QCR Documentation

Apply Quality Control

Description

Apply quality control information to the respective numeric vector.

Usage

apply_QC(x, qc, qc_thr = 2, na.as = NA)

Arguments

x

A numeric vector.

qc

A numeric vector.

qc_thr

An integer value.

na.as

An integer value or NA.

Details

Values of x are set to NA if qc value (flag) equals or is above qc_thr or if qc value is missing.

na.as = 0 can be used to preserve x values with respective NA qc values.

Value

A numeric vector of length x with attributes "varnames" and "units".

Examples

set.seed(215)
qc <- sample(0:2, 10, replace = TRUE)
apply_QC(1:10, qc)

# set stricter qc_thr
apply_QC(1:10, qc, qc_thr = 1)

# NAs in qc
is.na(qc) <- c(4, 6)
apply_QC(1:10, qc)

# preserve x values for NA qc
apply_QC(1:10, qc, na.as = 0)


lsigut/openeddy documentation built on Aug. 5, 2023, 12:25 a.m.