This simple function checks whether its first argument is a logical value
that evaluates to TRUE
. If so, it returns its second argument. If
not, it returns its third argument.
where(condition, value, fallback = NULL)
value
, if condition
evaluates to TRUE
;
otherwise fallback
.
An expression that resolves to a single logical value.
Any expression.
Jon Clayden
This function differs from the standard ifelse
function in
that it does not act elementwise, and that the third argument is optional,
defaulting to NULL
.
Please cite the following reference when using TractoR in your work:
J.D. Clayden, S. Muñoz Maniega, A.J. Storkey, M.D. King, M.E. Bastin & C.A. Clark (2011). TractoR: Magnetic resonance imaging and tractography with R. Journal of Statistical Software 44(8):1-18. tools:::Rd_expr_doi("10.18637/jss.v044.i08").
ifelse