qb_blocking: Constructor for qb_blocking objects

Description Usage Arguments Details Value Examples

Description

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.

Usage

1
qb_blocking(block_labels, unassigned_labels = NULL, ids = NULL)

Arguments

block_labels

a vector containing each unit's block label.

unassigned_labels

labels that denote unassigned units. If NULL, NA values in block_labels are used to denote unassigned units.

ids

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).

Details

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.

Value

Returns a qb_blocking object with the blocking described by the provided labels.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 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])

fsavje/quickblock documentation built on May 8, 2019, 8:33 a.m.