You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The get_summary_stats method is behaves different for grouped and ungrouped data. For grouped data, the user defined probabilites are ignored completely.
The example below shows the problem observed.
require(tidyverse)
require(assertthat)
require(rstatix)
# We need some probabilites we want to observe as quantiles
probabilities_to_observe <- c(0, .5, .66, 1)
# Create an arbitrary frame with a grouping variable (actually the groups are
# the same which is better to visualize the behavioral problem)
data <- data_frame(
gr=as.ordered(c("G1", "G1", "G1", "G1", "G1")),
value=runif(5,0,10)
)
summary1 <- data %>%
group_by(gr) %>%
get_summary_stats(value, type="quantile", probs = probabilities_to_observe)
summary2 <- data %>%
get_summary_stats(value, type="quantile", probs = probabilities_to_observe)
# Check for expected outputs
names2_to_have <- c("variable", "n", "0%", "50%", "66%", "100%")
names1_to_have <- c("gr", names2_to_have)
assertthat::are_equal(names(summary1), names1_to_have)
assertthat::are_equal(names(summary2), names2_to_have)
BR Daniel
The text was updated successfully, but these errors were encountered:
The
get_summary_stats
method is behaves different for grouped and ungrouped data. For grouped data, the user defined probabilites are ignored completely.The example below shows the problem observed.
BR Daniel
The text was updated successfully, but these errors were encountered: