Turns a cluster-level matrix into an element-level matrix by suitably duplicating rows or columns of the matrix.
distribute_matrix_across_clusters(
cluster_level_matrix,
cluster_ids,
rows = TRUE,
cols = TRUE
)The input cluster_level_matrix has its rows/columns
duplicated so that the number of rows (if rows=TRUE) or columns (if cols=TRUE)
equals the length of cluster_ids.
A square matrix, whose number of rows/columns matches the number of clusters.
A vector of cluster identifiers.
If rows=TRUE, the number of unique elements of cluster_ids
must match the number of rows of cluster_level_matrix.
If cols=TRUE, the number of unique elements of cluster_ids
must match the number of columns of cluster_level_matrix.
Whether to duplicate rows of the cluster_level_matrix for elements from the same cluster.
Whether to duplicate columns of the cluster_level_matrix for elements from the same cluster.