Skip to contents

The mark_preview() function creates a column labeling rows that are survey previews. The function is written to work with data from Qualtrics surveys.

Usage

mark_preview(
  x,
  id_col = "ResponseId",
  preview_col = "Status",
  rename = TRUE,
  quiet = FALSE,
  print = TRUE
)

Arguments

x

Data frame (preferably imported from Qualtrics using {qualtRics}).

id_col

Column name for unique row ID (e.g., participant).

preview_col

Column name for survey preview.

rename

Logical indicating whether to rename columns (using rename_columns())

quiet

Logical indicating whether to print message to console.

print

Logical indicating whether to print returned tibble to console.

Value

An object of the same type as x that includes a column marking rows that are survey previews. For a function that checks for these rows, use check_preview(). For a function that excludes these rows, use exclude_preview().

Details

Default column names are set based on output from the qualtRics::fetch_survey(). The preview column in Qualtrics can be a numeric or character vector depending on whether it is exported as choice text or numeric values. This function works for both.

The function outputs to console a message about the number of rows that are survey previews.

See also

Other preview functions: check_preview(), exclude_preview()

Other mark functions: mark_duplicates(), mark_duration(), mark_ip(), mark_location(), mark_progress(), mark_resolution()

Examples

# Mark survey previews
data(qualtrics_text)
df <- mark_preview(qualtrics_text)
#>  2 rows were collected as previews. It is highly recommended to exclude these rows before further processing.

# Works for Qualtrics data exported as numeric values, too
df <- qualtrics_numeric %>%
  mark_preview()
#>  2 rows were collected as previews. It is highly recommended to exclude these rows before further processing.