R/superspread_count.R
superspread_count.Rd
This function counts the number of occurrences per row in a number of categorical / single-code variables.
superspread_count(df, select_helpers = everything())
n number of new binary / multiple-choice columns / variables, with values representing the count of row-occurrences in the original set of input categorical/single-code variables. n represents the number of unique values found in the input variables.
Other superspread functions:
superspread()
if (FALSE) { # \dontrun{
library(data.table)
library(dplyr)
dt <- data.table(id = 1:10000,
cat1 = sample(letters[1:3],10000,replace = TRUE),
cat2 = sample(letters[1:4],10000,replace = TRUE),
cat3 = sample(letters[1:5],10000,replace = TRUE))
dt <- as.data.table(dt)
superspread_count(df = dt, select_helpers = contains("cat"))
} # }