View source: R/createBlockIDs.R
createBlockIDs | R Documentation |
Creates a vector of integers which represent unique blocks in an
object output from block
or assignment
.
createBlockIDs(obj, data, id.var)
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
.
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.
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.
Ryan T. Moore
block
, assignment
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.)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.