library(tidyverse)
library(ggdist)
library(ggpattern)
# Just look at a few categories
diamonds_small <- diamonds %>%
filter(cut %in% c("Fair", "Good", "Very Good"))
# Manually calculate summary statistics since we can't use stat_pointinterval()
library(tidyverse)
library(brms)
library(tidybayes)
data_thing <- tribble(
~answer, ~regime_type, ~n,
"Very familiar", "Democracy", 117,
"Very familiar", "Autocracy", 88,
library(tidyverse)
library(brms)
library(tidybayes)
library(marginaleffects)
# Example data with proportions
example_data <- tribble(
~answer, ~n, ~total,
"Very familiar", 88, 205,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Expected result | |
make_data("thing") | |
#> # A tibble: 2 × 1 | |
#> thing | |
#> <int> | |
#> 1 1 | |
#> 2 2 | |
# This doesn't work :( | |
make_data <- function(var_name) { |
library(tidyverse)
library(brms)
example_data <- tibble(outcome = c(rep(1, 200),
sample(2:31, 200, replace = TRUE),
rep(32, 150))) |>
mutate(outcome_0 = outcome - 1) |>
mutate(outcome_collapsed = case_when(
outcome == 1 ~ "1",
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
project: | |
type: book | |
book: | |
title: "Example article that is actually just a single-chapter book" | |
author: "Jane Doe" | |
date: "2023-02-28" | |
abstract: | | |
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. | |
search: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Example article that is actually a single normal .qmd file" | |
author: | |
- name: Jane Doe | |
affiliation: Big State University | |
- name: John Smith | |
affiliation: Liberal Arts College | |
abstract: | | |
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. | |
date: February 28, 2023 |
library(tidyverse)
# Manual way that gives you the most control over the areas
variable <- rnorm(1000)
variable_density <- density(variable)
example_df <- tibble(x = variable_density$x, y = variable_density$y) %>%
mutate(fill_stuff = case_when(
x < -1 ~ "Lower end",
library(tidyverse)
library(geomtextpath)
library(ggrepel)
library(broom)
library(palmerpenguins)
penguins <- penguins %>% drop_na(sex)
# geom_smooth by itself, for reference
library(tidyverse)
library(geomtextpath)
library(palmerpenguins)
penguins <- penguins %>% drop_na(sex)
ggplot(penguins, aes(x = bill_depth_mm, y = body_mass_g, color = species)) +
geom_point(size = 0.1) +
geom_smooth(method = "loess", se = FALSE) +