[Rd] Bug in base::mean.default ? (PR#12984)

Henrik Bengtsson hb at stat.berkeley.edu
Tue Sep 23 19:46:21 CEST 2008


Not a bug.  There is a statement in base::mean.default() before this

    if (na.rm)
        x <- x[!is.na(x)]

that removes any missing values.  Thus, it is known that there are no
missing values beyond this statement.

/Henrik

On Tue, Sep 23, 2008 at 8:25 AM,  <han at enfor.dk> wrote:
> In the body of base::mean.default the following piece of code is found:
>
>        if (trim >= 0.5)
>            return(stats::median(x, na.rm = FALSE))
>
> Should this not be
>
>         if (trim >= 0.5)
>            return(stats::median(x, na.rm = na.rm))
>
> where na.rm is supplied in the call to mean.default?
>
> If considered a bug I can imagine why it has low practical importance...
>
> Kind regards,
> Henrik
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



More information about the R-devel mailing list