Skip to contents

Fast pattern

Usage

fast.pattern(x, y, categories = 2, ...)

Arguments

x

Matrix (binary) of patterns. Optionally if y is also passed as argument, then the pattern matrix is defined as the elements agreeing in the two matrices.

y

Optional matrix argument with same dimensions as x (see above)

categories

Default 2 (binary)

...

Optional additional arguments

Author

Klaus K. Holst

Examples

X <- matrix(rbinom(100,1,0.5),ncol=4)
fast.pattern(X)
#> $pattern
#>       [,1] [,2] [,3] [,4]
#>  [1,]    0    1    1    0
#>  [2,]    0    0    0    0
#>  [3,]    0    0    1    1
#>  [4,]    1    0    0    0
#>  [5,]    1    1    1    1
#>  [6,]    1    0    1    0
#>  [7,]    0    0    1    0
#>  [8,]    1    0    1    1
#>  [9,]    1    1    0    0
#> [10,]    0    1    0    1
#> [11,]    0    0    0    1
#> [12,]    0    1    1    1
#> [13,]    1    1    1    0
#> [14,]    1    1    0    1
#> 
#> $group
#>       [,1]
#>  [1,]    0
#>  [2,]    1
#>  [3,]    1
#>  [4,]    0
#>  [5,]    2
#>  [6,]    3
#>  [7,]    4
#>  [8,]    2
#>  [9,]    1
#> [10,]    5
#> [11,]    6
#> [12,]    7
#> [13,]    8
#> [14,]    9
#> [15,]   10
#> [16,]   11
#> [17,]    4
#> [18,]    0
#> [19,]   11
#> [20,]    7
#> [21,]   12
#> [22,]    1
#> [23,]    8
#> [24,]   13
#> [25,]   13
#> 

X <- matrix(rbinom(100,3,0.5),ncol=4)
fast.pattern(X,categories=4)
#> $pattern
#>       [,1] [,2] [,3] [,4]
#>  [1,]    2    1    3    1
#>  [2,]    1    0    1    0
#>  [3,]    1    2    2    0
#>  [4,]    2    3    2    2
#>  [5,]    3    2    2    2
#>  [6,]    2    2    1    3
#>  [7,]    1    1    1    1
#>  [8,]    1    2    2    1
#>  [9,]    3    2    0    2
#> [10,]    1    1    1    0
#> [11,]    1    1    2    2
#> [12,]    0    1    1    2
#> [13,]    2    1    1    3
#> [14,]    2    2    2    2
#> [15,]    2    3    1    2
#> [16,]    1    1    2    1
#> [17,]    2    2    1    1
#> [18,]    2    3    3    2
#> [19,]    1    3    2    0
#> [20,]    3    1    1    1
#> [21,]    2    1    1    2
#> [22,]    0    3    2    2
#> [23,]    2    0    1    2
#> 
#> $group
#>       [,1]
#>  [1,]    0
#>  [2,]    1
#>  [3,]    2
#>  [4,]    3
#>  [5,]    4
#>  [6,]    5
#>  [7,]    6
#>  [8,]    5
#>  [9,]    7
#> [10,]    8
#> [11,]    7
#> [12,]    9
#> [13,]   10
#> [14,]   11
#> [15,]   12
#> [16,]   13
#> [17,]   14
#> [18,]   15
#> [19,]   16
#> [20,]   17
#> [21,]   18
#> [22,]   19
#> [23,]   20
#> [24,]   21
#> [25,]   22
#>