Skip to contents

Cleans survey data by filtering out rows based on a specified scenario variable.

Usage

step_clean_data(x, var_scenario, snapshot_data = FALSE)

Arguments

x

A data frame or tibble containing survey data.

var_scenario

A character string specifying the name of the scenario variable to use for filtering.

  • TRUE/1 value means we want to drop that response and

  • FALSE/0 value means we want to keep it.

snapshot_data

Logical. If TRUE, a snapshot of the data is taken. If FALSE, snapshot without data is taken. If NULL, no snapshot is taken.

Examples

if (FALSE) { # \dontrun{
data("srv_example", package = "g6tr.survey")
x <- srv_example |>
  mutate(
    flag_cs_01 = response_duration < 600,
    flag_cs_02 = response_duration < 900) |>
  select("response_id", starts_with("flag_cs_"), d_urban)

x <- x |>
  step_clean_data("flag_cs_01")
} # }