ifelse {salad}R Documentation

Conditionnal Element Selection

Description

‘ifelse' methods extend 'base::ifelse' to allow using dual objects for ’yes' or 'no' arguments.

Usage

ifelse(test, yes, no)

Arguments

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'.

Value

A dual object (dual vector).

Examples

x <- dual(c(1,2,4,6))
y <- ifelse(x > 2, x, x/2)
y
d(y)

[Package salad version 1.0 Index]