[R] Re : Frequency count

Thomas Lumley tlumley at u.washington.edu
Wed Jan 5 00:23:51 CET 2005


On Wed, 5 Jan 2005 ssim at lic.co.nz wrote:

> Dear list,
>
> I have a dataset as follow and I would like to count the frequencies for
> the combination of the two variables (f1 and f2)  for each id. I know it is
> should be straight forward, but I just don't know how to do it in R. Here
> is the SAS code I will use to get the output I want :

table() will count frequencies, and interaction() will create a variable 
with all combinations of a set of variables, so something like

table(interaction(f1,f2))

 	-thomas




More information about the R-help mailing list