[R] replacing NA values in an expression

Faheem Mitha faheem at email.unc.edu
Sat Apr 15 00:09:13 CEST 2000


Dear R people,

This is simple, nay trivial question. I do the following. I just want to
know what is the slickest/most elegant method. I have an expression
containing the term

(y)*log(y)

where y can take the value either 0 or 1. If y is 0 then the expression is
undefined, but in this case I want to replace the result by 0 in the
expression. I don't want to write a separate function for this, which
would be the simplest way of handling it, That is, I want this replacement
to be evaluated as part of the expression. What is the best way to do
this?
                                            Faheem.



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list