library(tidyverse)
library(broom)
model1 <- lm(hwy ~ displ + cyl, data = mpg)
model2 <- lm(hwy ~ displ + cyl + drv, data = mpg)
plot_data <- bind_rows(
tidy(model1, conf.int = TRUE) |> mutate(model = "Model 1"),
tidy(model2, conf.int = TRUE) |> mutate(model = "Model 2")
This file contains hidden or 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
| library(tidyverse) | |
| library(tinytable) | |
| inline_listify <- function(x) { | |
| numbers <- seq_along(x) | |
| prefixed <- paste0("(", numbers, ") ", x) | |
| collapsed <- paste(prefixed, collapse = "; ") | |
| return(collapsed) | |
| } |
This file contains hidden or 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
| library(tidyverse) | |
| library(gapminder) | |
| # ifelse() will happily work and coerce your numbers into text | |
| gapminder1 <- gapminder |> | |
| mutate(life_cat = ifelse(lifeExp > 75, "High", lifeExp)) | |
| # if_else() will yell at you | |
| gapminder1 <- gapminder |> | |
| mutate(life_cat = if_else(lifeExp > 75, "High", lifeExp)) |
This file contains hidden or 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
| --- | |
| - hosts: ubuntu | |
| become: yes | |
| tasks: | |
| - name: Add a new user named 'yourname' | |
| user: | |
| name: yourname | |
| state: present | |
| - name: Add 'yourname' to sudo group |
library(tidyverse)
example_draws <- tribble(
~category, ~shapes,
FALSE, c(10, 10, 13),
TRUE, c(7, 7, 8)
) |>
mutate(draws = map(shapes, ~{
withr::with_seed(1234, {library(tidyverse)
library(broom)
library(marginaleffects)
library(palmerpenguins)
penguins <- penguins %>% drop_na(sex)
model1 <- lm(body_mass_g ~ flipper_length_mm + species, data = penguins)library(tidyverse)
library(lme4)
library(marginaleffects)
# ?ChickWeight
# weight = body weight in grams
# Time = days since birth
# Chick = chick ID
# Diet = one of 4 possible diets
This file contains hidden or 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: Table testing | |
| format: | |
| html: default | |
| pdf: default | |
| --- | |
| ```{r, warning=FALSE, message=FALSE} | |
| library(tidyverse) | |
| library(gt) |
library(tidyverse)
withr::with_seed(1234, {
Wave1_original <- tibble(
AID = sample(1:51, 1000, replace = TRUE),
H1NM12A = sample(0:1, 1000, replace = TRUE),
H1NM12B = sample(0:1, 1000, replace = TRUE),
H1NM12C = sample(0:1, 1000, replace = TRUE),
H1NM12D = sample(0:1, 1000, replace = TRUE),
This file contains hidden or 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: "Table cross referencing stuff" | |
| format: | |
| html: default | |
| pdf: default | |
| docx: | |
| prefer-html: true # Because kableExtra complains | |
| --- | |
| ```{r setup, warning=FALSE, message=FALSE} |