Hi, all
a vector such as
(1,2,4,-1,NaN,2,4,NaN)
if try to replace all the NaN with a numerical value, what's the easiest
way?
thanks a lot
best
yong
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do
On Mon, 8 Mar 2004 18:18:28 -0600 (CST), you wrote:
Hi, all
a vector such as
(1,2,4,-1,NaN,2,4,NaN)
if try to replace all the NaN with a numerical value, what's the easiest
way?
x[is.nan(x)] - 42
See ?NaN for related functions.
Duncan Murdoch
__
On Mon, 8 Mar 2004, Yong Wang wrote:
Hi, all
a vector such as
(1,2,4,-1,NaN,2,4,NaN)
if try to replace all the NaN with a numerical value, what's the easiest
way?
thanks a lot
Is this what you wanted?
x-c(1,2,4,-1,NaN,2,4,NaN)
y-ifelse(is.nan(x),-999,x)
y
[1]124