ls_eq_nestIfs {limonaid} | R Documentation |
Create a series of nested LSEM if
equations
Description
This function takes a series of conditions and corresponding values, and builds an equation consisting of nested if statements.
Usage
ls_eq_nestIfs(conditions, values, elseExpr, quoteValues = FALSE)
Arguments
conditions |
The conditions - in the right order, i.e. in the produced expression if nested if statements, the first condition in this list will be checked first, then the second, etc. |
values |
The values corresponding to each condition (in the same order!). |
elseExpr |
The value to return if there are no matches. |
quoteValues |
Whether to use double quotes to quote the values. |
Value
A character value.
Examples
### Relatively simple example with four levels of nesting
ls_eq_nestIfs(c("age.NAOK > 80",
"age.NAOK > 65",
"age.NAOK > 40",
"age.NAOK > 20"),
c("Respectable",
"Roughly retired",
"Roughly middle-aged",
"Quite young"),
"Very young",
quoteValue=TRUE);
[Package limonaid version 0.1.5 Index]