ifelse | R Documentation |
‘ifelse' methods extend 'base::ifelse' to allow using dual objects for ’yes' or 'no' arguments.
ifelse(test, yes, no)
test |
an object which can be coerced to logical mode. |
yes |
return values for true elements of 'test'. |
no |
return values for false elements of 'test'. |
A dual object (dual vector).
x <- dual(c(1,2,4,6))
y <- ifelse(x > 2, x, x/2)
y
d(y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.