Description Usage Arguments Value See Also Examples
The alt() function is used to build alternative 'case'
branches for the switch-case construct. Each alternative branch consist of
four elements: The test condition, the code that is executed if the
condition evaluates to TRUE, an optional return value which
switchCase() will return if the condition is met and after
the branch code has ben executed, and an optional logical value indicating
if the switch-case construct will be left after this branch has been
executed.
1 |
condition |
The condition that the test expression ( |
code.if |
The code that is executed if the condition is met. If the code stretches over multiple R statements then use curly brackets to enclose the whole code segment. |
return.val |
A value that is returned if the condition is met and after
the code in |
break.case |
A logical value indicating if the switch-case construct
will be left after the condition of this alternative 'case' branch of the
switch-case construct has been met and the code in |
An alternative branch that can be used in a switch-case construct
(technically, a list object).
Other switchcase:
switchCase()
1 | alt(.(..expr > 10), .(cat("The result is larger than 10.")), "10plus")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.