assignment {blockTools} | R Documentation |
Using an output object from block
, assign elements
of each row to treatment condition columns. Each element is equally
likely to be assigned to each column.
assignment(block.obj, seed = NULL, namesCol = NULL)
block.obj |
an output object from block , or a user-specified
block object. |
seed |
a user-specified random seed. |
namesCol |
an optional vector of column names for the output table. |
block.obj
can be specified directly by the user. It can be a
single dataframe or matrix with blocks as rows and treatment conditions
as columns. assignment
is designed to take a list with two
elements. The first element should be named {tt $blocks}, and should
be a list of dataframes. Each dataframe should have blocks as rows and
treatment conditions as columns. The second element should be a logical
named {tt $level.two}. A third element, such as $call
in a
block
output object, is currently ignored.
Specifying the random seed yields constant assignment, and thus allows for easy replication of experimental protocols.
If namesCol = NULL
, then ``Treatment 1", ``Treatment 2", ... are
used.
A list with elements
assg |
a list of dataframes, each containing a group's blocked units assigned to treatment conditions. If there are two treatment conditions, then the last column of each dataframe displays the multivariate distance between the two units. If there are more than two treatment conditions, then the last column of each dataframe displays the largest of the multivariate distances between all possible pairs in the block. |
call |
the orginal call to assignment . |
Ryan T. Moore
data(x100) ## First, block out <- block(x100, groups = "g", n.tr = 2, id.vars = c("id"), block.vars = c("b1", "b2"), algorithm="optGreedy", distance = "mahalanobis", level.two = FALSE, valid.var = "b1", valid.range = c(0,500), verbose = TRUE) ## Second, assign assigned <- assignment(out, seed = 123) ## assigned$assg contains 3 data frames