I would like to use the functionality of modelsummary::datasummary_skim
such that two tables are aligned side-by-side including the histograms and only the mean of the variables, e.g.
library(modelsummary)
library(dplyr)
library(kableExtra)
normal_df <- data.frame(
var1 = c(1:3, 50:53, 100:102),
var2 = runif(10),
var3 = seq(10, 100, 10)
)
outlier_df <- tibble::tribble(
~var1, ~var2, ~var3,
1, 1000, 10.5,
2, 20000, 100.6,
3, 32, 1000.3
) %>% as.data.frame()
# This is how datasummary_skim looks like
datasummary_skim(normal_df)
# this is how it could work using datasummary
datasummary(All(normal_df) ~ Mean + Histogram, normal_df) %>%
kable_styling(full_width = FALSE, position = "float_left") %>%
add_header_above(c("", "Normal" = 2))
datasummary(All(outlier_df) ~ Mean + Histogram, outlier_df) %>%
kable_styling(full_width = FALSE, position = "left") %>%
add_header_above(c("", "Outlier" = 2))
The problem is that the histograms are not displayed anymore. Any ideas/hints are much appreciated!