[R] Is ther a possibility to display the log(frequency) instead of the frequency in the hist plot?

ben@zoo.ufl.edu ben at zoo.ufl.edu
Thu Jan 18 22:54:57 CET 2001


  The only potential problem with this solution is that bins with zero
counts and bins with 1 count will both be treated as zeros.

  Consider:

my.data <- c(1.5,1.5,2.5,4.5,5.5,5.5)
my.hist.counts <- hist(my.data, plot=F, breaks=0:6)$counts

etc.

  This is an unlikely event with the default "breaks" settings,
though.  (On the other hand, the fact that you have bins with zero counts
says that you might well have bins with only 1 count.)

  Ben

On Thu, 18 Jan 2001, Alexander A. Morgan wrote:

> I imagine that the point of logging the histogram count axis is just for
> displaying purposes, and your suggestion would alter the scale.  I find it
> easier to just leave the 0 counts as zero.
>
> hist(my.data, plot=F)$counts -> my.hist.counts;
> my.hist.counts[my.hist.counts != 0] <-
>                       log(my.hist.counts[my.hist.counts!= 0]);
> plot(my.hist.counts, type="hist");
>
>
> -Alex Morgan
>
> Phone: 781-271-6306                       "They laughed at Newton.
> Office: 3K-136                            They laughed at Einstein.
> AOL Instant Messenger: HomeySage          But they also laughed at Groucho
>                                           Marx."
>                                                       --Carl Sagan
>
> On Thu, 18 Jan 2001, Peter Kleiweg wrote:
>
> > Witold Eryk Wolski skriver...
> >
> > > Some questions still remain to me.
> > > 1. How take an log if one of the my.hist$counts equals 0?
> >
> > log(my.hist$counts + 1)
> >
> > --
> > Peter Kleiweg
> > http://www.let.rug.nl/~kleiweg/
> >
> > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> > r-help 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-help-request at stat.math.ethz.ch
> > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> >
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help 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-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>

-- 
318 Carr Hall                                bolker at zoo.ufl.edu
Zoology Department, University of Florida    http://www.zoo.ufl.edu/bolker
Box 118525                                   (ph)  352-392-5697
Gainesville, FL 32611-8525                   (fax) 352-392-3704

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list