A function to randomize a new subject

Share:

Description

A function to randomize a new subject to a treatment given factor variables

Usage

1
randomize(object, subject.id, factor.values)

Arguments

object

An object of class PocockSimonRandomizer

subject.id

A string identifying the subject; no check is made on uniqueness

factor.values

A vector of factor values for the subject

Value

Returns an object of PocockSimonRandomizer class that contains the orginal object with updated slots

Author(s)

Balasubramanian Narasimhan

See Also

lastRandomization

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
expt <- ClinicalExperiment(number.of.factors = 3,
                           number.of.factor.levels = c(2, 2, 3),
                           number.of.treatments = 3)
r.obj <- new("PocockSimonRandomizer", expt, as.integer(12345))
r.obj <- randomize(r.obj, "Subject-001", c("1","2","2"))
## Try once again with same subject and you should get an error
## r.obj <- randomize(r.obj, "Subject-001", c("1","2","2"))
## Or try with a bad factor value and you should get an error
## r.obj <- randomize(r.obj, "Subject-002", c("1","2","5"))
lastRandomization(r.obj)