The mirror of qc_genotypes() for the observation side: flags the missing code,
flags Tukey-fence outliers (turning them into missing rather than DROPPING the
row, removing a row silently changes contemporary groups and pen compositions),
and reports contemporary-group levels too small to estimate. Everything it does
is counted and returned; nothing is silent.
Usage
qc_phenotypes(
data,
trait,
missing_code = NULL,
classes = NULL,
fence = 3,
min_class_n = 2L,
fence_by = NULL
)Arguments
- data
data.frame
- trait
observation column
- missing_code
the missing-value code in use (NA is always treated as missing)
- classes
optional class columns (contemporary group, pen) to scan for levels with fewer than
min_class_nobserved records, and for missing labels- fence
Tukey multiplier: outliers fall outside quartiles +/- fence * IQR (3 by default, the "far out" fence; 1.5 flags far more)
- min_class_n
classes with FEWER observed records than this are reported (default 2: singleton and empty levels)
- fence_by
optional column whose classes get fences of their own (an age class, a period): for a trait that grows with age one fence over all records flags nothing in the young and only normal records in the old. A class with fewer than 8 observed records keeps the fences of all records
Value
list with data (outliers turned into missing), n_missing (before the
outlier pass), n_outliers, fences (the two cutoffs), small_classes
(per class column, HOW MANY levels fall under min_class_n) and missing_labels
(per class column, how many rows hold a missing label: NA, NaN, Inf, -Inf,
blank text or the text "NaN", which every fitter refuses on any row; those rows are
not a level and do not enter small_classes). It has the class br_qc, whose print
shows the summary and not data: the records stay in $data, out of the console and
of any session log