extract_conditions: Create vector of integers containing treatment condition...

View source: R/extract_conditions.R

extract_conditionsR 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 assignment.

data

The data frame that was input into block for blocking.

id.var

A string specifying which column of data contains identifying information.

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

assignment

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 are represented by integers.)


blockTools documentation built on Oct. 20, 2024, 1:08 a.m.