The qb_blocking
function constructs a qb_blocking
object from
existing block labels. The function does not derive blockings from
sets of data points; see quickblock
for that functionality.
qb_blocking(block_labels, unassigned_labels = NULL, ids = NULL)
a vector containing each unit's block label.
labels that denote unassigned units. If NULL
, NA
values in
block_labels
are used to denote unassigned units.
IDs of the units. Should be a vector of the same length as
block_labels
or NULL
. If NULL
, the IDs are set to
1:length(group_labels)
.
Returns a qb_blocking
object with the blocking described by the
provided labels.
qb_blocking
objects are based on integer vectors, and it indexes
the blocks starting with zero. The qb_blocking
class inherits
from the scclust
class.
# NOT RUN { # 10 units in 3 blocks blocking1 <- qb_blocking(c("A", "A", "B", "C", "B", "C", "C", "A", "B", "B")) # 8 units in 3 blocks, 2 units unassigned blocking2 <- qb_blocking(c(1, 1, 2, 3, 2, NA, 3, 1, NA, 2)) # Custom labels indicating unassigned units blocking3 <- qb_blocking(c("A", "A", "B", "C", "NONE", "C", "C", "NONE", "B", "B"), unassigned_labels = "NONE") # Two different labels indicating unassigned units blocking4 <- qb_blocking(c("A", "A", "B", "C", "NONE", "C", "C", "0", "B", "B"), unassigned_labels = c("NONE", "0")) # Custom unit IDs blocking5 <- qb_blocking(c("A", "A", "B", "C", "B", "C", "C", "A", "B", "B"), ids = letters[1:10]) # }