# countpattern

From e1071 v1.7-3
by David Meyer

##### Count Binary Patterns

Every row of the binary matrix `x`

is transformed into a binary
pattern and these patterns are counted.

- Keywords
- multivariate

##### Usage

`countpattern(x, matching=FALSE)`

##### Arguments

- x
A matrix of binary observations

- matching
If TRUE an additional vector is returned which stores which row belongs to which pattern

##### Value

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`

.

##### Examples

```
# NOT RUN {
xx <- rbind(c(1,0,0),c(1,0,0),c(1,0,1),c(0,1,1),c(0,1,1))
countpattern(xx)
countpattern(xx, matching=TRUE)
# }
```

*Documentation reproduced from package e1071, version 1.7-3, License: GPL-2 | GPL-3*

### Community examples

Looks like there are no examples yet.