Skip to content
Prev 157019 / 398506 Next

Counting character occurrences in data frame

Thanks Charles, ftable() works perfectly. 

-----Original Message-----
From: Charles C. Berry [mailto:cberry at tajo.ucsd.edu] 
Sent: Tuesday, September 23, 2008 5:06 PM
To: Hutchinson,David [PYR]
Cc: r-help at r-project.org
Subject: Re: [R] Counting character occurrences in data frame



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:

            
to
http://www.R-project.org/posting-guide.html
Charles C. Berry                            (858) 534-2098
                                             Dept of Family/Preventive
Medicine
E mailto:cberry at tajo.ucsd.edu	            UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego
92093-0901