utility function to subset data based on minimum number of observation per level
prep_min_obs_level(study_data, group_vars, min_obs_in_subgroup)
a data frame with:
a subsample of original data
data.frame the data frame that contains the measurements
variable list the name grouping variable
integer optional argument if a "group_var" is used. This argument specifies the minimum no. of observations that is required to include a subgroup (level) of the "group_var" in the analysis. Subgroups with less observations are excluded. The default is 30.
This functions removes observations having less than min_obs_in_subgroup
distinct values in a group variable, e.g. blood pressure measurements
performed by an examiner having less than e.g. 50 measurements done. It
displays a warning, if samples/rows are removed and returns the modified
study data frame.