where {SBCK} | R Documentation |
where function
Description
This function return a vector / matrix / array of the same shape than cond / x / y such that if(cond) values are x, and else y.
Usage
where(cond,x,y)
Arguments
cond |
[vector/matrix/array] Boolean values |
x |
[vector/matrix/array] Values if cond is TRUE |
y |
[vector/matrix/array] Values if cond is FALSE |
Value
z [vector/matrix/array].
Examples
x = base::seq( -2 , 2 , length = 100 )
y = where( x < 1 , x , exp(x) ) ## y = x if x < 1, else exp(x)
[Package SBCK version 1.0.0 Index]