View source: R/superspread_count.R
superspread_count | R Documentation |
This function counts the number of occurrences per row in a number of categorical / single-code variables.
superspread_count(df, select_helpers = everything())
df |
Data frame to apply function to. |
select_helpers |
Use dplyr select helpers to apply function only to required columns. Leave blank to include 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()
## Not run:
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"))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.