pivot_percent_at {dataMojo} | R Documentation |
Create an aggregated data table with all proportion of one selected column
pivot_percent_at(dt, question_col, aggregated_by_cols)
dt |
data table |
question_col |
column selected as questions |
aggregated_by_cols |
grouped by columns |
aggregated data table
test_dt <- data.table::data.table(
Question = c(rep("Good", 3), rep("OK", 3), rep("Bad", 3)),
Gender = c(rep("F", 4), rep("M", 5))
)
dataMojo::pivot_percent_at(test_dt,
question_col = "Question", aggregated_by_cols = "Gender")