extract_conditions {blockTools} | R Documentation |
Create vector of integers containing treatment condition identifiers
Description
Creates a vector of integers which represent unique treatment conditions
in an object output from assignment
.
Usage
extract_conditions(assg.obj, data, id.var)
Arguments
assg.obj |
an output object from |
data |
the data frame that was input into |
id.var |
a string specifying which column of |
Details
Under the current implementation, level.two
in block
should be set to FALSE
.
Value
A numeric vector of integers with nrow(data)
elements with
lowest value equal to 1, corresponding to the treatment condition column
from the assignment object each unit is in. For example, if the columns of the assignment object are Treatment
and Control
(in that order), then Treatment
will be represented by a 1
and Control
will be represented by a 2
.
For units in data
that are not in assg.obj
, the value of NA
is assigned.
Author(s)
Ryan T. Moore
See Also
Examples
data(x100)
out <- block(x100, groups = "g", n.tr = 2, id.vars = c("id"),
block.vars = c("b1", "b2"))
assg <- assignment(out)
extract_conditions(assg, x100, id.var = "id")
# Treatment conditions represented by integers.