Re: [Rd] unwarranted warning from hist.default (PR#9356)

From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>
Date: Fri 10 Nov 2006 - 22:39:14 GMT

deepayan.sarkar@gmail.com writes:

> > x = rnorm(100)
> > b = seq(min(x) - 1, max(x) + 1, length = 11)
> > b
> [1] -3.4038769 -2.7451072 -2.0863375 -1.4275678 -0.7687980 -0.1100283
> [7] 0.5487414 1.2075111 1.8662808 2.5250506 3.1838203
> >
> > invisible(hist(x, breaks = b, include.lowest = TRUE, plot = FALSE))
> Warning message:
> argument 'include.lowest' is not made use of in: hist.default(x,
> breaks = b, include.lowest = TRUE, plot = FALSE)
>
>
> I don't think a warning is appropriate, since ?hist says:
>
> include.lowest: logical; if 'TRUE', an 'x[i]' equal to the 'breaks'
> value will be included in the first (or last, for 'right =
> FALSE') bar. This will be ignored (with a warning) unless
> 'breaks' is a vector.
>
> and in this case 'breaks' does qualify as a "vector" by my understanding.
>
> Note that the warning goes away with 'plot=TRUE'. This suggests that
> this might have something to do with this vaguely worded entry in the
> NEWS for R 2.4.0:
>
> o hist(*, plot = FALSE) now warns about unused arguments.
>
> Neither the help page nor the NEWS file indicates what arguments are
> considered 'unused' when 'plot = FALSE', but either possibility ---
> (1) include.lowest is actually unused and (2) it is used and the
> warning is wrong --- is a bug.

As I read the code, the purpose is to warn people if they supply plot arguments (density, xlim, ylim,....) while plot=FALSE. There's a stop list coded by

        nf <- nf[is.na(match(nf, c("x", "breaks", "freq", "nclass", 
            "plot", "probability")))]

and I think the problem is just that "include.lowest" should have been on the list.

-- 
   O__  ---- Peter Dalgaard             Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)                  FAX: (+45) 35327907

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Sat Nov 11 09:42:45 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 11 Nov 2006 - 00:30:42 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.