From p.dalgaard@biostat.ku.dk  Tue Dec  2 12:21:39 1997
From: p.dalgaard@biostat.ku.dk (Peter Dalgaard BSA)
Date: 02 Dec 1997 13:21:39 +0100
Subject: R-alpha: Re: wish ``hist() returning ..'' --- and if plot=T ?
In-Reply-To: Martin Maechler's message of Tue, 2 Dec 1997 12:26:32 +0100
References: <199712021126.MAA01905@sophie.ethz.ch>
Message-ID: <x2lny4lyuk.fsf@blueberry.kubism.ku.dk>

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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


R-alpha: Re: wish ``hist() returning ..'' --- and if plot=T ?
Peter Dalgaard BSA