Learn R Programming

blockTools (version 0.6.6)

extract_conditions: 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)

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.

Arguments

assg.obj

An output object from assignment.

data

The data frame that was input into block for blocking.

id.var

A string specifying which column of data contains identifying information.

Author

Ryan T. Moore

Details

Under the current implementation, level.two in block should be set to FALSE.

See Also

assignment

Examples

Run this code
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.)

Run the code above in your browser using DataLab