
Define a discrete fixed-class effect in a phenotype model
Source:R/define_effect_fixed_class.R
define_effect_fixed_class.RdInserts a row into phenotype_effects representing a discrete fixed effect:
each level of source_column maps to a numeric shift on the phenotype
scale. The null_class_action argument controls what happens when an
individual has a NULL value for source_column at phenotyping time.
Usage
define_effect_fixed_class(
pop,
phenotype_name,
effect_name,
source_column,
levels,
source_table = "ind_meta",
null_class_action = c("skip", "error", "zero"),
overwrite = FALSE
)Arguments
- pop
A
tidybreed_popobject.- phenotype_name
Character. Name of an existing phenotype in
phenotype_meta.- effect_name
Character. Unique label for this effect within the phenotype. Must be a valid SQL identifier.
- source_column
Character. Column in
source_tableholding the group membership. Must be a valid SQL identifier.- levels
Named numeric vector mapping level strings to shifts, e.g.
c(M = 30, F = 0). Every level present in the data at phenotyping time must appear here.- source_table
Character. Database table containing
source_column. Default"ind_meta".- null_class_action
Character. Behaviour when
source_columnisNULLfor an individual:"skip"(default) — individual is excluded fromind_phenotypefor this phenotype; a warning lists the count."error"— hard stop when anyNULLis encountered. Use for effects likesexthat should never be missing."zero"— treatNULLas a zero-shift contribution (reference level).
- overwrite
Logical. Replace an existing effect with the same name.
Examples
if (FALSE) { # \dontrun{
pop <- pop |>
define_effect_fixed_class("ADG", "sex",
source_column = "sex",
levels = c(M = 30, F = 0))
} # }