R/ls_recodeTable_to_equations.R
ls_recodeTable_to_equations.Rd
This function takes a dataframe with LimeSurvey (LS) variable codes
and values, and builds a nested set of LimeSurvey Equation Manager (LSEM)
if/then/else equations where the variable code in each row (in the
varCodeCol
) is compared to the corresponding value (i.e. the value in
the same row in the valueCol
column) using the operator specified in that
row in the operatorCol
column (or the ==
operator, if no operator is
specified). In the case of a match, the value in the corresponding
recodeToCol
column is returned. If there is no match, the comparison
on the next row is evaluated, all the way down. If nothing matches, the
elseExpr
is returned.
ls_recodeTable_to_equations(
data,
varCodeCol = limonaid::opts$get("recTab2Eq_varCodeCol"),
valueCol = limonaid::opts$get("recTab2Eq_valueCol"),
recodeToCol = limonaid::opts$get("recTab2Eq_recodeToCol"),
operatorCol = limonaid::opts$get("recTab2Eq_operatorCol"),
elseExpr = limonaid::opts$get("eq_elseExpr"),
naok = TRUE
)
The dataframe.
The name or index of the column with the variable code.
The name or index of the column with the values to compare the value of the variable code to.
The name or index of the column with the value to return in the case of a match.
The name or index of the column with the operator used to build each logical expression.
The value to return if there are no matches.
Whether to append ".NAOK
" to variable codes by default.
A character value.
### Provide later