where | R Documentation |
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)
cond |
[vector/matrix/array] Boolean values |
x |
[vector/matrix/array] Values if cond is TRUE |
y |
[vector/matrix/array] Values if cond is FALSE |
z [vector/matrix/array].
x = base::seq( -2 , 2 , length = 100 )
y = where( x < 1 , x , exp(x) ) ## y = x if x < 1, else exp(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.