ransch: ransch

View source: R/tables.R

ranschR Documentation

ransch

Description

Generate block randomization schedule tables.

Usage

ransch(n, block, arms, r = 1L, strata = NULL)

ranschtbl(n, block, arms, r = 1L, strata = NULL, write = NULL)

Arguments

n

sample size of study or each stratum

block

block size; note if block is not a factor of n, n will be increased to accommodate a full block

arms

names of the treatment arms

r

randomization ratio; see examples

strata

an optional named list of vectors for each stratum

write

a file path to write a directory with csv files for each randomization table

Examples

## no strata, 2-3 treatments with varying randomization ratios
ransch(24, 4, 1:2) ## 1:1
ransch(24, 6, 1:3) ## 1:1:1
ransch(24, 8, 1:3, c(1, 2, 1)) ## 1:2:1

## one two-level stratum
ransch(24, 4, 1:2, strata = list(Age = c('<65', '>=65')))

## multiple strata
strata <- list(Site = LETTERS[1:3], Age = c('<65', '>=65'))
ransch(24, 4, 1:2, strata = strata)


## tables for printing
ranschtbl(24, 4, c('Pbo', 'Trt'))
ranschtbl(24, 4, c('Pbo', 'Trt'), c(1, 3), strata)

## Not run: 
ranschtbl(24, 4, c('Pbo', 'Trt'), strata = strata, write = '~/desktop')

## End(Not run)


raredd/desmon2 documentation built on Feb. 9, 2023, 12:09 p.m.