.BG
.FN ifelse
.TL
Conditional Data Selection
.CS
ifelse(cond, true, false)
.AG cond
logical vector.
.AG true
vector containing values to be returned if `cond' is `TRUE'.
.AG false
vector containing values to be returned if `cond' is `FALSE'.
.RT
object with the attributes of `cond' and data values
from the values of `true' or `false' depending on
`cond'.  If `true' or `false' are not as large as `cond',
they will be repeated cyclically.  Missing values (`NA's) are
allowed.  `NA' values in `cond' cause `NA's in the result.
.EX
log(ifelse(x>0,x,NA))  # compare the example in `if'.
.PP
The above example avoids the warning message from taking logs of negative
numbers.
.SA
`if', `switch'.
.KW logic
.KW manip
.WR
