Skip to contents

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
)

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_n observed 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)

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)