unite_exclusions: Unite multiple exclusion columns into single column

View source: R/unite_exclusions.R

unite_exclusionsR Documentation

Unite multiple exclusion columns into single column

Description

Each of the mark_*() functions appends a new column to the data. The unite_exclusions() function unites all of those columns in a single column that can be used to filter any or all exclusions downstream. Rows with multiple exclusions are concatenated with commas.

Usage

unite_exclusions(
  x,
  exclusion_types = c("duplicates", "duration", "ip", "location", "preview", "progress",
    "resolution"),
  separator = ",",
  remove = TRUE
)

Arguments

x

Data frame or tibble (preferably exported from Qualtrics).

exclusion_types

Vector of types of exclusions to unite.

separator

Character string specifying what character to use to separate multiple exclusion types

remove

Logical specifying whether to remove united columns (default = TRUE) or leave them in the data frame (FALSE)

Value

An object of the same type as x that includes the all of the same rows but with a single exclusion column replacing all of the specified exclusion_* columns.

Examples


# Unite all exclusion types
df <- qualtrics_text %>%
  mark_duplicates() %>%
  mark_duration(min_duration = 100) %>%
  mark_ip() %>%
  mark_location() %>%
  mark_preview() %>%
  mark_progress() %>%
  mark_resolution()
df2 <- df %>%
  unite_exclusions()

# Unite subset of exclusion types
df2 <- df %>%
  unite_exclusions(exclusion_types = c("duplicates", "duration", "ip"))

excluder documentation built on Feb. 16, 2023, 7:09 p.m.