On 10/5/07, Leeds, Mark (IED) <[EMAIL PROTECTED]> wrote:
> x[is.na(x)]<- y[is.na(x)] but this will only work correctly if x and y
> are the same length so I hope that is
> what you mean by the same style.
That can be fixed if y is at least as long as to reach the last NA
in x like this:
x[is.na(
To: [EMAIL PROTECTED]
Subject: [R] replacing NA's with various numbers
Hi
I have two vectors in the same style as
x<-c(NA,NA,1,3,4,NA,1)
y<-c(0,0,NA,NA,NA,0,NA)
that is when x[ i ] = NA, y[ i ]=numeric. I wish to replace the NA's in
x by the corresponding y value. Any help would
Hi
I have two vectors in the same style as
x<-c(NA,NA,1,3,4,NA,1)
y<-c(0,0,NA,NA,NA,0,NA)
that is when x[ i ] = NA, y[ i ]=numeric. I wish to replace the NA's in x by
the corresponding y value. Any help would be much appreciated.
Nigel
__
R-help@r-pr
3 matches
Mail list logo