Skip to contents

Fetches responses and applies so-called "R-syntax" transformation script from LimeSurvey pertaining factor levels and items labels (those are readily available in RStudio data frame preview and can be extracted using attr(.data, "label")). By default, the function attempts to "clean" the labels (clean_labels argument), keeping only the content inside [...], if there are any.

Usage

ls_responses(
  survey_id,
  clean_labels = TRUE,
  lang = "cs",
  part = "all",
  response_type = "long",
  standardize_dates = TRUE,
  ...
)

Arguments

survey_id

integer, ID of the survey (as found with ls_surveys, e.g.).

clean_labels

logical, whether to clean labels of subquestions from repeating parts. Defaults to TRUE.

lang

character, ISO 639 language code, default to cs.

part

character, completion status, either complete, incomplete or all (the default).

response_type

character, either long (the default) or short. Passed to LimeSurvey as sResponseType. Since LimeSurvey 7.9.0, the "R-syntax" script adds answer labels (factor levels) only with long, otherwise you get raw answer codes. See https://bugs.limesurvey.org/view.php?id=19889.

standardize_dates

logical, whether to standardize dates to Date.

...

other named arguments used by "export_responses" method. Use at your own risk.

Value

A tibble, or raw object if server response cannot be reasonably coerced to a tibble.

Examples

if (FALSE) { # \dontrun{
ls_responses(123456)
} # }