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 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) |
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: "tikz in Quarto!" | |
format: html | |
--- | |
```{r include=FALSE} | |
# Necessary for using dvisvgm on macOS | |
# See https://www.andrewheiss.com/blog/2021/08/27/tikz-knitr-html-svg-fun/ | |
Sys.setenv(LIBGS = "/usr/local/share/ghostscript/9.53.3/lib/libgs.dylib.9.53") |
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 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
# ------------------------------------------------------------------------------------------ | |
# Basically all translated from the Python example at https://atproto.com/blog/create-post | |
# ------------------------------------------------------------------------------------------ | |
library(httr2) | |
# Create a logged-in API session object | |
session <- request("https://bsky.social/xrpc/com.atproto.server.createSession") |> | |
req_method("POST") |> | |
req_body_json(list( |
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
library(reticulate) | |
# Run `pip install atproto` in the terminal to instally the Python atproto library | |
atproto <- import("atproto") | |
# Create a new empty client | |
client <- atproto$Client() | |
# Log into the API | |
profile <- client$login(Sys.getenv("BSKY_USER"), Sys.getenv("BSKY_PASS")) |
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
library(tidyverse) | |
library(palmerpenguins) | |
library(broom) | |
# Get rid of missing values | |
penguins <- penguins %>% drop_na(sex) | |
# Scatterplot | |
ggplot(penguins, aes(x = bill_length_mm, y = body_mass_g)) + | |
geom_point() + |
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
$$ | |
\begin{align} | |
&\ \textbf{Registered provinces for INGO } i \\ | |
\text{Count of provinces}\ \sim&\ \operatorname{Ordered\,Beta}(\mu_{i_j}, \phi_y, k_{0_y}, k_{1_y}) \\[8pt] | |
&\ \textbf{Model of outcome average} \\ | |
% Put the huge equation in a nested \begin{aligned}[t] environment so that | |
% \mathrlap{} can go around it so that the annotations in the priors can be | |
% aligned closer to the math | |
\mu_i =&\ | |
\mathrlap{\begin{aligned}[t] |
library(tidyverse)
# Example data
df <- tibble(org_id = 1:10,
outcome = 1:10,
issue_1 = c("A", "B", "C", "D", "E", "F", "G", "H", "I", "J"),
issue_2 = c(NA, NA, "X", NA, "Y", NA, NA, NA, NA, "Z"))
df
#> # A tibble: 10 × 4