# Summarise the variable at the halfway point in the simulation. tab <- df %>% dplyr::filter(time == round(max(time) / 2)) %>% dplyr::summarise(Minimum = min(.data[[var]]), `25th Percentile` = quantile(.data[[var]], probs = 0.25), Median = median(.data[[var]]), Mean = mean(.data[[var]]), `75th Percentile` = quantile(.data[[var]], probs = 0.75), Maximum = max(.data[[var]])) tab %>% kableExtra::kbl(caption = paste("Summary of", var, "at the halfway point in the simulation."), digits = 3, format.args = list(big.mark = ",", scientific = FALSE)) %>% kableExtra::kable_classic(full_width = F, html_font = "Cambria")
if(tab$Minimum[1] == tab$Maximum[1]) { cat(var, "does not vary. We always use the value:", prettyNum(tab$Minimum[1], big.mark = ",", scientific = FALSE)) } else { df %>% ggplot2::ggplot(aes(x = .data[[var]])) + geom_density(fill = "turquoise4", alpha = 0.80) + ylab("Density") + theme_bw() }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.