This function creates a sparse co-occurrence matrix from entity data, which is more memory-efficient for large datasets.
create_sparse_comat(
entity_data,
doc_id_col = "doc_id",
entity_col = "entity",
count_col = NULL,
type_col = NULL,
normalize = TRUE
)A sparse matrix of entity co-occurrences.
A data frame with document IDs and entities.
Name of the column containing document IDs.
Name of the column containing entity names.
Name of the column containing entity counts (optional).
Name of the column containing entity types (optional).
Logical. If TRUE, normalizes the co-occurrence matrix.