On Wed, Mar 17, 2004 at 04:55:19PM +0200, Kai Hendry wrote:
> I am trying to construct a frequency table. I guess this should be done with
> table. Or perhaps factor and split. Or prop.table. cut? findInterval? Argh!

> I got this far:
> > table(cut(zz$x9, brk))
> 
>  (40,50]  (50,60]  (60,70]  (70,80]  (80,90] (90,100]
>        2       19       21       19        8        1
> > brk
> [1]  40  50  60  70  80  90 100
> > 
> > t(table(cut(zz$x9, brk)))
>      (40,50] (50,60] (60,70] (70,80] (80,90] (90,100]
> [1,]  2      19      21      19       8       1
> 
> Still feels a million miles off.

Why? To me it looks like you figured it all out. You found out how to
use cut() to get the appropriate factor and you used table() to
compute the counts. Nothing wrong with that...

The only difference to what you wanted to get is that your example looked
more like a data frame. Try

as.data.frame(yourtable)

which will give you something like this:

> as.data.frame(tbl)
         b Freq
1   (0,20]   17
2  (20,40]   28
3  (40,60]   19
4  (60,80]   15
5 (80,100]   21

Is that what you wanted?

cu
        Philipp

-- 
Dr. Philipp Pagel                            Tel.  +49-89-3187-3675
Institute for Bioinformatics / MIPS          Fax.  +49-89-3187-3585
GSF - National Research Center for Environment and Health
Ingolstaedter Landstrasse 1
85764 Neuherberg, Germany
http://mips.gsf.de/~pagel

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to