Obtain Permutation Matrix from a Random Assignment Declaration

obtain_permutation_matrix(declaration, maximum_permutations = 10000)

declaration | A random assignment declaration, created by |
---|---|

maximum_permutations | If the number of possible random assignments exceeds maximum_permutations, obtain_permutation_matrix will return a random sample of maximum_permutations permutations. Defaults to 10,000. |

a matrix of all possible (or a random sample of all possible) random assignments consistent with a declaration.

# complete declaration <- declare_ra(N = 4) perms <- obtain_permutation_matrix(declaration) dim(perms)#> [1] 4 6obtain_num_permutations(declaration)#> [1] 6# blocked block_var <- c("A", "A", "B", "B", "C", "C", "C") declaration <- declare_ra(block_var = block_var) perms <- obtain_permutation_matrix(declaration) dim(perms)#> [1] 7 24obtain_num_permutations(declaration)#> [1] 24# clustered clust_var <- c("A", "B", "A", "B", "C", "C", "C") declaration <- declare_ra(clust_var = clust_var) perms <- obtain_permutation_matrix(declaration) dim(perms)#> [1] 7 6obtain_num_permutations(declaration)#> [1] 6#> [1] 184756perms <- obtain_permutation_matrix(declaration) dim(perms)#> [1] 20 10000