Skip to content

Instantly share code, notes, and snippets.

View maxdrohde's full-sized avatar

Maximilian Rohde maxdrohde

View GitHub Profile
library(MASS)
library(plotrix)
library(tidyverse)
library(gganimate)
####################################
## Example 1 (Data by Group with means and estimated means)
####################################
## Number of groups, observations per group
@maxdrohde
maxdrohde / plot.R
Created August 31, 2023 23:40
patchwork + ggtext example
library(ggplot2)
library(patchwork) # For composing plots
# See https://patchwork.data-imaginist.com/
library(ggtext) # For formatting text using markdown syntax
# See https://wilkelab.org/ggtext/
# Make a ggplot histogram from a vector of data
gg_hist <- function(x){
data.frame(x) |>
@maxdrohde
maxdrohde / display.R
Created January 15, 2024 20:57
display.R
# Display data frame as a nicely formatted and interactive GT table
display <- function(df){
df |>
gt::gt() |>
gt::opt_interactive(use_search = TRUE,
use_compact_mode = TRUE,
use_text_wrapping = TRUE) |>
gt::opt_stylize(style = 2) |>
gt::cols_width(everything() ~ px(250))
}