powered by
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.
where(cond,x,y)
z [vector/matrix/array].
[vector/matrix/array] Boolean values
[vector/matrix/array] Values if cond is TRUE
[vector/matrix/array] Values if cond is FALSE
x = base::seq( -2 , 2 , length = 100 ) y = where( x < 1 , x , exp(x) ) ## y = x if x < 1, else exp(x)
Run the code above in your browser using DataLab