Dear R helpers I seem to have one trivial problem but can't find solution to it.
Suppose I have following input. A = c(1, 3, 0, 5, 8) # 3rd element is 0 B = c(100, 30, 0, 25, 40) # 3rd element is 0 C = A/B > C [1] 0.01 0.10 NaN 0.20 0.20 Obviously, I can't divide 0/0 and hence NaN. My problem is how to replace this NaN say by 0. So that I can have C as C = c(0.01, 0.10, 0, 0.20, 0.20) I tried the replace command but can't get rid of NaN. Kindly guide. Vincy [[alternative HTML version deleted]]
______________________________________________ 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.