View source: R/ls_eq_nestIfs.R
ls_eq_nestIfs | R Documentation |
if
equationsThis function takes a series of conditions and corresponding values, and builds an equation consisting of nested if statements.
ls_eq_nestIfs(conditions, values, elseExpr, quoteValues = FALSE)
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. |
A character value.
### 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);
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.