Re: [R] Dividing by 0

From: Roland Rau <>
Date: Fri, 25 Jul 2008 15:23:38 -0400


what about:

mydata <- c(1,2,3,NA, Inf, -Inf, NaN, 5, 6, 7) mydata2 <- ifelse( | is.infinite(mydata),

                       0, mydata)


nmarti wrote:
> I know I can use x <- na.omit(x), and other forms of this, to get rid of
> some of these errors.

I know what you mean, I think, but I would not call it errors. Rather, it is following a standard specification. Check

for further information (and the links therein).

Hope this helps,
Roland mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Fri 25 Jul 2008 - 19:26:36 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 25 Jul 2008 - 19:32:30 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive