[R] Count number of different patterns (Polytomous variable)

Erik Iverson eiverson at NMDP.ORG
Tue Sep 8 19:33:49 CEST 2009


If your data.frame was called "test" below, 

nrow(unique(test)) 

would do what you want, I believe. 

Erik 

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of "Biedermann, Jürgen"
Sent: Tuesday, September 08, 2009 9:24 AM
To: r-help at r-project.org
Subject: [R] Count number of different patterns (Polytomous variable)

Hi there,

Does anyone know a method to calculate the number of different patterns 
in a given data frame. The variables are of polytomous type and not 
binary (for the latter i found a package called "countpattern" which 
unfortunately only functions for binary variables).

V1   V2   V3
0   3   1
1   2   0
1   2   0

So, in this case, i would like to get "2" as output.




More information about the R-help mailing list