Creates a baseline column in several different ways. Helper for baseline_compare() but useful elsewhere too
create_base.RdCreates a baseline column in several different ways. Helper for baseline_compare() but useful elsewhere too
Usage
create_base(
val_df,
compare_col,
base_lev,
values_col,
group_cols = NULL,
failmissing = TRUE,
names_to,
values_to
)Arguments
- val_df
dataframe of values
- compare_col
column or columns to use for grouping- needed if the baseline is one level in this column. Otherwise ignored
- base_lev
value for baseline. Can be a level in
compare_col, or a scalar, or a vector oflength(unique(val_df$compare_col)). A dataframe would be useful but not yet implemented.- values_col
column containing the values. Can be character or tidyselect or bare names, though the last are fragile.
- group_cols
character, columns to group the baselining by. Often spatial or env_obj or similar.
- failmissing
logical, default TRUE. Use
tidyselect::any_ofortidyselect::all_ofwhenvalues_colorcompare_colare character. seeselectcreator()- names_to
character, as in
tidyr::pivot_longer(), used for auto-pivotting- values_to
character, as in
tidyr::pivot_longer(), used for auto-pivotting