View source: R/extract_conditions.R
extract_conditions | R Documentation |
Creates a vector of integers which represent unique treatment conditions
in an object output from assignment
.
extract_conditions(assg.obj, data, id.var)
assg.obj |
An output object from |
data |
The data frame that was input into |
id.var |
A string specifying which column of |
Under the current implementation, level.two
in block
should be set to FALSE
.
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.
Ryan T. Moore
assignment
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 are represented by integers.)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.