R-alpha: Re: wish ``hist() returning ..'' --- and if plot=T ?
Peter Dalgaard BSA
p.dalgaard@biostat.ku.dk
02 Dec 1997 13:21:39 +0100
Martin Maechler <maechler@stat.math.ethz.ch> writes:
> PD> Martin: Wouldn't it be better to return
>
> PD> invisible(list(breaks = breaks, counts = counts))
>
> PD> in the plot=T case? (currently it's invisible(NULL) )
>
> Yes, it would be better;
> I even remember having thought about it....
> ahh, the reason I did not implement it, is that S-plus is different:
> It returns something else for plot=TRUE:
>
> S> x_ rnorm(50)
> S> hi_ hist(x)
> S> h2_ hist(x,plot=F)
> S> hi
> [1] -2.5 -1.5 -0.5 0.5 1.5 2.5
> S> h2
> $breaks:
> [1] -3 -2 -1 0 1 2 3
>
> $counts:
> [1] 1 6 14 22 6 1
>
> ---
> Do we want S-compatibility here?
> (At that time, I hated the idea that the return value is so different, just
> depending on the plot=.. value).
Hmmm. In S, hist() calls barplot() with
VALUE:
a non-printing vector which contains the x-coordinates of
the centers of the bars (y-coordinates if the bars are
horizontal). The returned value can be used if you want
to add to the plot.
This is actually quite useful for placing labels, etc. However,
presumably you'd want the counts too, so a list containing the union
of the two might be ideal? How about relative frequencies, BTW?
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._