R: Obtain Permutation Matrix from a Random Assignment...

obtain_permutation_matrix {randomizr} | R Documentation

## Obtain Permutation Matrix from a Random Assignment Declaration

### Description

Obtain Permutation Matrix from a Random Assignment Declaration

### Usage

    obtain_permutation_matrix(declaration, maximum_permutations = 10000)

### Arguments

`declaration` | A random assignment declaration, created by `declare_ra`.
`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.

### Value

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

### Examples

    # complete

    declaration <- declare_ra(N = 4)
    perms <- obtain_permutation_matrix(declaration)
    dim(perms)
    obtain_num_permutations(declaration)

    # blocked

    blocks <- c("A", "A", "B", "B", "C", "C", "C")
    declaration <- declare_ra(blocks = blocks)
    perms <- obtain_permutation_matrix(declaration)
    dim(perms)
    obtain_num_permutations(declaration)

    # clustered

    clusters <- c("A", "B", "A", "B", "C", "C", "C")
    declaration <- declare_ra(clusters = clusters)
    perms <- obtain_permutation_matrix(declaration)
    dim(perms)
    obtain_num_permutations(declaration)

    # large

    declaration <- declare_ra(20)
    choose(20, 10)
    perms <- obtain_permutation_matrix(declaration)
    dim(perms)

[Package randomizr version 0.18.0 Index]