Re: [R] "Raw" histogram plots

From: Charilaos Skiadas <cskiadas_at_gmail.com>
Date: Wed, 27 Feb 2008 08:48:13 -0500

On Feb 27, 2008, at 8:16 AM, Andre Nathan wrote:

> On Wed, 2008-02-27 at 14:15 +1300, Peter Alspach wrote:
>> If I understand you correctly, you could try a barplot() on the
>> result
>> of table().
>
> Hmm, table() does the counting exactly the way I want, i.e., just
> counting individual values. Is there a way to extract the counts
> vs. the
> values from a table, so that I can pass them as the x and y
> arguments to
> plot()?
>

x <- table(rbinom(20,2,0.5))
plot(names(x),x)

should do it. You can also try just plot(x). Use prop.table on table if you want the relative frequencies instead.

> Thanks,
> Andre

Haris Skiadas
Department of Mathematics and Computer Science Hanover College



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 27 Feb 2008 - 14:07:02 GMT

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 Wed 27 Feb 2008 - 17:30:16 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive