Re: [R] Replacing an element in a vector

2011-02-28 Thread Ivan Calandra
Dear Vincy, Try this: C[is.nan(C)] <- 0 HTH, Ivan Le 2/28/2011 13:10, Vincy Pyne a écrit : 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, 4

[R] Replacing an element in a vector

2011-02-28 Thread Vincy Pyne
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 di