createBlockIDs {blockTools} | R Documentation |
Create vector of integers containing block identifiers
Description
Creates a vector of integers which represent unique blocks in an
object output from block
or assignment
.
Usage
createBlockIDs(obj, data, id.var)
Arguments
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
.
If blocking was performed specifying a groups
argument,
createBlockIDs
will assign block ID values that are unique
across groups. In other words, createBlockIDs
does not restart
numbering when it encounters a new group of blocks.
Value
A numeric vector of integers with nrow(data)
elements with
lowest value equal to 1, corresponding to the block each unit is in.
For units in data
that are not in 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"))
createBlockIDs(out, x100, id.var = "id")
## block ID integers are unique, even with several groups