This function applies specific code bits from the LimeSurvey data import R script, read by ls_parse_data_import_script(), for example to update variable names, set labels, etc.

ls_apply_script_bits(
  data,
  scriptBits,
  setVarNames = TRUE,
  setLabels = TRUE,
  convertToCharacter = FALSE,
  convertToFactor = FALSE,
  categoricalQuestions = NULL,
  massConvertToNumeric = TRUE,
  silent = limonaid::opts$get("silent"),
  sticky = limonaid::opts$get("sticky")
)

Arguments

data

The dataframe.

scriptBits

The object returned by the call to ls_parse_data_import_script().

setVarNames, setLabels, convertToCharacter, convertToFactor

Whether to set variable names or labels, or convert to character or factor, using the code isolated using the specified regular expression.

categoricalQuestions

Which variables (specified using LimeSurvey variable names) are considered categorical questions; for these, the script to convert the variables to factors, as extracted from the LimeSurvey import file, is applied.

massConvertToNumeric

Whether to convert all variables to numeric using massConvertToNumeric.

silent

Whether to be silent or verbose ('chatty').

sticky

Whether to make labels sticky (requires the sticky package).

Value

The dataframe.