[R] Drawing a histogram from a massive dataset

Joshua Wiley jwiley.psych at gmail.com
Mon Jul 18 22:11:09 CEST 2011


On Mon, Jul 18, 2011 at 10:57 AM, Paul Smith <phhs80 at gmail.com> wrote:
> [snip] I guess that I must have a data frame to plot a histogram.

Not at all!

## a *vector* of 100 million observation
x <- rnorm(10^8)
## a histogram for it (see attached for the result from my system)
hist(x)

No data frame required.  I would not try this straight in anything but
traditional graphics for a 100 million observation vector, but if you
wanted it made in ggplot2 or something, you could prebin the data and
THEN plot bars corresponding to the bins.

Cheers,

Josh

-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
https://joshuawiley.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hist.pdf
Type: application/pdf
Size: 4679 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110718/610c7803/attachment.pdf>


More information about the R-help mailing list