[R] Question about is.na for missing data

Karl Ove Hufthammer karl at huftis.org
Thu Oct 29 18:12:34 CET 2009


On Thu, 29 Oct 2009 11:45:19 -0500 David Kaplan 
<dkaplan at education.wisc.edu> wrote:
> asd[is.na(asd)] <- mean(asd,na.rm=TRUE)
> 
> This has worked quite well in the past.  Now, however, I am getting the 
> following error messsage.
> 
> Error in `[<-.data.frame`(`*tmp*`, is.na(asd), value = 
> c(2433.64150943396,  :
>   rhs is the wrong length for indexing by a logical matrix
> 
> An inspection of the data set reveals no value of the sort give above.  
> Any thoughts?

I would venture to guess that your 'asd' object is not of the type you 
think it is. What is the value of

str(asd)

-- 
Karl Ove Hufthammer



More information about the R-help mailing list