[R] hist() Frequancy values

J.delasHeras at ed.ac.uk J.delasHeras at ed.ac.uk
Wed Jul 18 20:14:34 CEST 2007

Quoting Manuele Pesenti <amicogodzilla at bruttocarattere.org>:

> I have seen that the hist() function plots an histogram of the   
> frequency but I
> cannot find the value of the object hist that contains theese values... how
> is possible to get out them?
> thank you very mutch
> best regards
> 	Manuele

if you add 'plot=FALSE', like this:


instead of plotting the histogram, you get a list of values. The  
component $counts
contains what you're looking for.

You can give it a name: a<-hist(rnorm(100),plot=FALSE), and treat it  
like any other list.
(if you do "a<-hist(rnorm(100))" then you get both the values and the plot)

check ?hist for details.


Dr. Jose I. de las Heras                      Email: J.delasHeras at ed.ac.uk
The Wellcome Trust Centre for Cell Biology    Phone: +44 (0)131 6513374
Institute for Cell & Molecular Biology        Fax:   +44 (0)131 6507360
Swann Building, Mayfield Road
University of Edinburgh
Edinburgh EH9 3JR

More information about the R-help mailing list