countpattern.Rd
Every row of the binary matrix x
is transformed into a binary
pattern and these patterns are counted.
countpattern(x, matching=FALSE)
x | A matrix of binary observations |
---|---|
matching | If TRUE an additional vector is returned which stores which row belongs to which pattern |
A vector of length 2\^ncol(x)
giving the number of times each
pattern occurs in the rows of x
. The names of this vector are the
binary patterns. They are sorted according to their numeric value.
If matching
is TRUE
, a list of the following two vectors is returned.
Numbers of patterns as described above.
Vector giving the position of the pattern of each row
of x
in pat
.
#> 000 001 010 011 100 101 110 111 #> 0 0 0 2 2 1 0 0countpattern(xx, matching=TRUE)#> $pat #> 000 001 010 011 100 101 110 111 #> 0 0 0 2 2 1 0 0 #> #> $matching #> [1] 5 5 6 4 4 #>