ifelse | R Documentation |
ifelse
returns a value with the same shape as test
which is
filled with elements selected from either yes
or no
depending
on whether the element of test
is TRUE
or FALSE
.
## S4 method for signature 'fm,fm,ANY' ifelse(test, yes, no) ## S4 method for signature 'fm,ANY,fm' ifelse(test, yes, no) ## S4 method for signature 'fmV,fmV,ANY' ifelse(test, yes, no) ## S4 method for signature 'fmV,ANY,fmV' ifelse(test, yes, no)
test |
a logical FlashR vector or matrix. |
yes |
a FlashR vector or matrix or an R scalar. |
no |
a FlashR vector or matrix or an R scalar. |
The current implementation requires either yes
or no
to be
a scalar value.
A FlashR vector or matrix of the same size and attributes
(including dimensions) as test
and data values from the values
of yes
or no
.
mat <- fm.runif.matrix(100, 10) mat <- ifelse(mat > 0.5, mat, 0)