[R] Re : Frequency count

ssim@lic.co.nz ssim at lic.co.nz
Tue Jan 4 23:36:07 CET 2005


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 :

proc means nway;
class id f1 f2;
var flag
output out=temp;


Dataset:
id    f1    f2    flag
798   1     2     1
777   0     2     1
798   2     2     1
777   0     2     1
777   1     1     1

Output:
Id=798
1-2   1
2-2   1

Id=777
0-2   2
1-1   1
___________________________________________________________________________
This message, including attachments, is confidential. If you...{{dropped}}




More information about the R-help mailing list