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@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.

Reply via email to