Skip to content

CTU-Bern/randolist

Repository files navigation

randolist

R-CMD-check

randolist contains home-grown functions for creating randomisation lists in R.

Installation

You can install the development version of randolist from github with:

remotes::install_github("CTU-Bern/randolist")

Generating randomization lists

Load the package

library(randolist)

Unstratified randomization

Where no strata are defined, the blockrand function can be used to create a randomization list.

blockrand(n = 10, 
          blocksizes = 1:2)
#>    seq_in_list block blocksize seq_in_block arm
#> 1            1     1         4            1   A
#> 2            2     1         4            2   A
#> 3            3     1         4            3   B
#> 4            4     1         4            4   B
#> 5            5     2         2            1   A
#> 6            6     2         2            2   B
#> 7            7     3         4            1   B
#> 8            8     3         4            2   A
#> 9            9     3         4            3   B
#> 10          10     3         4            4   A

The treatment label is set via the arms argument.

Block sizes are defined via the blocksizes argument. The above example creates a randomization list with blocks of 1 or 2 of each arm (so in practice, the block sizes are 2 and 4).

Allocation schemes beyond 1:1 randomization are possible by specifying the arms argument, specifically by using the same arm label multiple times.

blockrand(n = 10, 
          blocksizes = 1:2,
          arms = c("A", "A", "B"))
#>    seq_in_list block blocksize seq_in_block arm
#> 1            1     1         6            1   A
#> 2            2     1         6            2   B
#> 3            3     1         6            3   A
#> 4            4     1         6            4   B
#> 5            5     1         6            5   A
#> 6            6     1         6            6   A
#> 7            7     2         6            1   A
#> 8            8     2         6            2   B
#> 9            9     2         6            3   A
#> 10          10     2         6            4   B
#> 11          11     2         6            5   A
#> 12          12     2         6            6   A

About

R package for creating randomisation lists

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages