gregory_r_warnes@groton.pfizer.com
2001-Jun-04 17:29 UTC
[Rd] boxplot.stats() returns wrong value for n (PR#967)
Full_Name: Gregory R. Warnes Version: R 1.2.3 OS: Linux (debian test) Submission from: (NULL) (192.77.198.200) The documentation for boxplot.stats() states that the element "n" of the return list is "the number of of non-`NA' observations in the sample.". However, boxplot.stats() currently returns the total number of observations instead. Example:> boxplot.stats( c(1:10,rep(NA,10) ) )$stats [1] 1.0 3.0 5.5 8.0 10.0 $n [1] 20 $conf [1] 3.733506 7.266494 $out numeric(0) The problem is the statement n <- length(nna) # including +/- Inf in boxplot.stats(). It should be n <- sum(nna) # including +/- Inf Correcting this line yields:> boxplot.stats( c(1:10,rep(NA,10) ) )$stats [1] 1.0 3.0 5.5 8.0 10.0 $n [1] 10 $conf [1] 3.001801 7.998199 $out numeric(0) -Greg -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel 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-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._