processLSvarLabels: A function to conveniently process LimeSurvey labels

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/processLSvarLabels.R

Description

This function is meant to quickly parse the variable labels set by LimeSurvey. It works particularly well with dual anchor array questions, where the left and right anchors as well as the subquestions are extracted automatically.

Usage

1
2
3
4
5
6
7
8
9
processLSvarLabels(dat,
                   varnameRegExPairs = NULL,
                   labelExtractionRegExPair = c("\\[(.*)\\].*", "\\1"),
                   lengthToWrap = 50,
                   lengthToWrapAnchors = 20,
                   leftAnchorRegExPairs = list(c(".*[[:graph:]]([A-Z][a-z][^|]*)\\|(.+)",
                                                 "\\1")),
                   rightAnchorRegExPairs = list(c(".*[[:graph:]]([A-Z][a-z][^|]*)\\|(.+)",
                                                  "\\2")))

Arguments

dat

The dataframe as produced by importLimeSurveyData.

varnameRegExPairs

Pairs of regular expressions to replace in the variable names. This is useful when some pattern can be applied to the variable names to, for example, add underscores te denote different parts of the variable name. This has to be a list of character vectors that each have length 2.

labelExtractionRegExPair

The regular expression pair used to extract the labels.

lengthToWrap

At how many characters to wrap the subquestions.

lengthToWrapAnchors

At how many characters to wrap the anchors.

leftAnchorRegExPairs

The regular expression pairs to use to extract the left anchors.

rightAnchorRegExPairs

The regular expression pairs to use to extract the right anchors.

Details

This function processes LimeSurvey variable labels and applies regular expressions to automatically extract subquestions and left and right anchors.

Value

A dataframe that can conveniently be used with detStructAddVarLabels.

Author(s)

Gjalt-Jorn Peters

Maintainer: Gjalt-Jorn Peters <[email protected]>

References

(Forthcoming)

See Also

determinantStructure, determinantVar, subdeterminants, subdeterminantProducts, detStructAddVarLabels, detStructAddVarNames, detStructComputeProducts, detStructComputeScales, detStructCIBER

Examples

1
2
### No examples provided yet; this would require data to be included,
### and that's not available yet.

userfriendlyscience documentation built on May 2, 2018, 5:06 p.m.