Hi,

what about:

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

mydata
mydata2

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
?is.finite

for further information (and the links therein).

Hope this helps,
Roland

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to