Re: [R] How is the relation between Frequency and Counts in hist/density defined?

From: <>
Date: Mon, 23 May 2011 15:56:07 +0100

> In order to do this I can use the relation between count and density, but
> would like to know if there is a way for me to predict it upfront.
   In the code for hist.default, you'll see the line    dens <- counts/(n * diff(breaks))
> Here is an example:
> set.seed(242)
> z = rnorm(30)
> hist_z <- hist(z)
> hist_z$counts / hist_z$density # the relation is 15
   In your example, n is 30, and the breaks are evenly spaced every 0.5.    Regards,
   Mathematical Sciences Unit
   [2]4D Pie Charts

   ATTENTION:    This message contains privileged and confidential information intended for    the addressee(s) only. If this message was sent to you in error, you must    not disseminate, copy or take any action in reliance on it and we request    that you notify the sender immediately by return email.

   Opinions expressed in this message and any attachments are not necessarily    those held by the [3]Health and Safety Laboratory or any person connected    with the organisation, save those by whom the opinions were expressed.

   Please note that any messages sent or received by the [4]Health and Safety    Laboratory email system may be monitored and stored in an information    retrieval system.

   Think before you print - do you really need to print this email?

   Scanned by MailMarshal - Marshal's comprehensive email content security    solution. Download a free evaluation of MailMarshal at [5]


  5. mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code.
Received on Mon 23 May 2011 - 14:58:48 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 23 May 2011 - 15:50:08 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive