[R] possible bug in sd

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Mon Oct 21 14:58:05 CEST 2002


"Liaw, Andy" <andy_liaw at merck.com> writes:

> function (x, na.rm = FALSE) 
> {
>     if (is.matrix(x)) 
>         apply(x, 2, sd)
>     else if (is.vector(x)) 
>         sqrt(var(x, na.rm = na.rm))
>     else if (is.data.frame(x)) 
>         sapply(x, sd)
>     else sqrt(var(as.vector(x), na.rm = na.rm))
> }
> 
> Notice how the na.rm argument never got passed in the apply() and sapply()
> calls.  I'd call that a bug alright.

Fixed for 1.6.1beta (as of tomorrow).

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list