[R] na.rm in sd()
tlumley at u.washington.edu
Wed Jan 29 19:49:24 CET 2003
On Wed, 29 Jan 2003, Heberto Ghezzo wrote:
> Hello, I think this qualify as a bug
> > x<-c(1,2,3,4,NA,6,7)
> > mean(x)
>  NA
> > mean(x,na.rm=T)
>  3.833333
> > sd(x)
> Error in var(as.vector(x)) : missing observations in cov/cor
> > sd(x,na.rm=T)
> Error in sd(x, na.rm = T) : unused argument(s) (na.rm ...)
> > var(x)
> Error in var(x) : missing observations in cov/cor
> > var(x,na.rm=T)
>  5.366667
> why sd() does not recognize the na.rm=T parameter, while var does?
> R 1.6.1 on Win98
It works for me in R 1.6.1 on Windows.
and looking at the code for sd it certainly should. Are you sure you
don't have another defintion of sd() lurking?
More information about the R-help