>>>>> "Gad" == Gad Abraham <[EMAIL PROTECTED]> >>>>> on Tue, 20 Mar 2007 17:02:18 +1100 writes:
Gad> Hi, Gad> Is this a bug in truehist()? >> library(MASS) >> x <- rep(1, 10) >> truehist(x) Gad> Error in pretty(data, nbins) : invalid 'n' value You get something similar though slightly more helpful from hist(x, "scott") which then uses the same method for determining the number of bins / classes for the histogram. I'd say the main "bug" is in nclass.scott() [ and also nclass.FD() ] which do not work when var(x) == 0 as in this case. One could argue that 1) truehist(x) should not use "scott" as default when var(x) == 0 {hence a buglet in truehist()} and either 2) both hist() and truehist() should produce a better error message when "scott" (or "FD") is used explicitly and var(x) == 0 or, rather IMO, 3) nclass.scott(x) and nclass.FD(x) should be extended to return a non-negative integer even when var(x) == 0 Martin Maechler, ETH Zurich ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.