Create a Count Table with Percentages, Mean, and SD
Source:R/counting.R
, R/pcir.package.R
counting.Rd
This function takes a data frame and computes the count and percentage of each value across specified columns. It also calculates the weighted mean and standard deviation for each variable. The output is a summary data frame useful for analyzing distributions of ordinal or Likert-type scales.
Create a count table with percentages, mean, and standard deviation. This function takes a data frame, computes summary statistics like counts, percentages, means, and standard deviations for each unique value in the selected columns.
Value
A data frame in wide format containing:
Counts of each value per variable
Percentages of each value per variable
Weighted mean
Weighted standard deviation
A data frame with computed statistics, including counts, percentages, means, and standard deviations. df1 <- data.frame(A = c(-1, -1, -1, 0, -1), B = c(-1, 1, 0, -1, 1)), C = c(0, 0, 1, 0, -1), D = c(0, -1, 1, 1, 1), E = c(1, 1, 0, -1, -1)) counting(df1, cols = c('A', 'B', 'C', 'D', 'E'))