summarize.exposures: Counts the number of units receiving each exposure

Description Usage Arguments Value Examples

View source: R/rand-mechanisms.R

Description

For each row of the input matrix ‘W.mat’, computes the number of units receiving each exposure.

Usage

1

Arguments

W.mat

A matrix. Each row represents an exposure vector, so if the matrix is K x N, then K is the number of exposure vectors, and N the number of units in the population.

Value

A matrix with the same number of rows as ‘W.mat’, and whose number of columns is equal to the number of unique exposures in ‘W.mat’.

Examples

1
2
3
4
5
W.mat <- rbind(c(0, 1, 1, 2, 0, 1), c(1, 1, 0, 0, 0, 0))
summarize.exposures(W.mat)
#      0 1 2
# [1,] 2 3 1
# [2,] 4 2 0

gwb/RGroupFormation documentation built on Sept. 13, 2020, 4:41 p.m.