powered by
Aggregates values within groups using specified method
aggregate_data(data, group_col, variable_column, value_column, method)
Aggregated data frame
Data frame to aggregate
Column name for grouping
Column name containing variable identifiers
Column name containing values to aggregate
Aggregation method: "mean", "median", "sum"
test_data <- data.frame( Group = rep(c("A", "B"), each = 10), Variable = rep(paste0("V", 1:5), 4), Value = rnorm(20) ) agg <- aggregate_data(test_data, "Group", "Variable", "Value", "mean")
Run the code above in your browser using DataLab