Prepares a dataset for proportion-based analysis by:

  • Removing rows with unknown insecticide intervention (if requested),

  • Renaming and standardizing column names,

  • Filtering out rows with missing numerators or denominators,

  • Warning when the numerator exceeds the denominator.

create_datareq(data.req, varname, remove_unknown_insecticide = TRUE)

Arguments

data.req

A `data.frame` containing the dataset.

varname

Character string; prefix used to identify the computed proportion columns (e.g., `"endophily"`, `"parous_rate"`).

remove_unknown_insecticide

Logical; if `TRUE` (default), removes rows where `insecticide_control` is `"t"` or unknown.

Value

A filtered and cleaned dataframe, excluding rows with missing denominators and (optionally) unknown insecticide interventions.

Details

This function assumes that proportions have already been computed using augment_withProportion_modif, resulting in columns like `<varname>.num` and `<varname>.den`.

Additional processing steps:

  • The `species` column is renamed to `survey`.

  • Whitespace is removed from `insecticide_control` to create a new column `intervened`.

  • A warning is issued if any rows have `varname.num > varname.den`.

  • The total number of valid observations is printed.