Skip to contents

This function takes in a dataframe which contains an outlier column name specified by the outlier_col_name.

Usage

indicate_ww_exclusions(
  data,
  outlier_col_name = "flag_as_ww_outlier",
  remove_outliers = TRUE
)

Arguments

data

A dataframe containing a column indicating outliers, called outlier_col_name.

outlier_col_name

A character string indicating the name of the column containing the outlier indicator, must contain only 0 or 1

remove_outliers

A boolean indicating whether or not to exclude the outliers from the fitting. If TRUE, copy outliers to exclusions, if FALSE, set exclusions to none

Value

a dataframe with the same columns as in data plus an additional exclude column containing 0s for the data to be passed to the model and 1s where the data should be excluded

Examples

data <- tibble::tibble(
  date = lubridate::ymd(c("2023-10-01", "2023-10-02")),
  genome_copies_per_mL = c(300, 3e6),
  flag_as_ww_outlier = c(0, 1),
  exclude = c(0, 0)
)
data_w_exclusions <- indicate_ww_exclusions(data,
  outlier_col_name = "flag_as_ww_outlier",
  remove_outliers = TRUE
)