Re: [R] Counting character occurrences in data frame

2008-09-24 Thread Hutchinson,David [PYR]
Thanks Charles, ftable() works perfectly. -Original Message- From: Charles C. Berry [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 23, 2008 5:06 PM To: Hutchinson,David [PYR] Cc: r-help@r-project.org Subject: Re: [R] Counting character occurrences in data frame See

Re: [R] Counting character occurrences in data frame

2008-09-23 Thread Charles C. Berry
See ?ftable ?as.data.frame ?xtabs e.g. ftable( xtabs( ~code+year+month, your.df ), col.vars=1 ) as.data.frame( xtabs(~code+year+month, your.df ) ) HTH, Chuck On Tue, 23 Sep 2008, Hutchinson,David [PYR] wrote: Hi R-Users, I have a data frame contai

Re: [R] Counting character occurrences in data frame

2008-09-23 Thread Henrique Dallazuanna
Try this: with(DF, tapply(code, list(year, month, code), length)) On Tue, Sep 23, 2008 at 8:10 PM, Hutchinson,David [PYR] <[EMAIL PROTECTED]> wrote: > Hi R-Users, > > I have a data frame containing year, month, day, and code columns. The > code column is a unique character of set ('E','A','B') -

[R] Counting character occurrences in data frame

2008-09-23 Thread Hutchinson,David [PYR]
Hi R-Users, I have a data frame containing year, month, day, and code columns. The code column is a unique character of set ('E','A','B') - I am trying to determine an efficient way of summarizing the count of each of these codes by month and year without having to use for...loops and subsets. Do