
New page, who dis?
his is my copy-paste template for new blog posts. I got tired of looking up the same Quarto features every time, so this is essentially just a growing example for me.
YAML frontmatter
Copy this header and adjust:
title: "Your Title Here"
description: "Brief description for SEO and social cards"
date: 2025-01-15
categories: [Statistics, R]
tags: ["brms", "Bayesian"]
draft: false # set to true to hide
cache: true # speeds up builds for R-heavy posts
Optional stuff:
heroImage
: Header image pathlastUpdated
: When you edited it
Typography
Drop caps are gorgeous:
<span class="dropcap dropcap--ornate dropcap--serious" data-first-letter="T" aria-hidden="true">T</span> ext starts here...
Math: inline like
Citations: (Cinelli, Forney, and Pearl 2020) if you have a references.bib
file.
Margin notes:
margin: This appears in the right margin.
Normal notes:
I am not in the morgin but in the middle of the text instead.
R Code
Basic chunk:
library(ggplot2)
library(dplyr)
set.seed(42)
data <- data.frame(
x = rnorm(100),
y = rnorm(100) + 0.3 * rnorm(100),
group = sample(c("A", "B", "C"), 100, replace = TRUE)
)
head(data, 3)
x y group
1 1.3709584 0.6006866 B
2 -0.5646982 1.1448842 B
3 0.3631284 -0.6518111 C
Plots
ggplot(data, aes(x = x, y = y, color = group)) +
geom_point(alpha = 0.7) +
theme_minimal() +
labs(title = "Sample Data", x = "X values", y = "Y values")
margin: Chunk options go after
#|
. Main ones:label
,echo
,eval
,include
,warning
,error
.
Collapsible code
For longer setup that would clutter the post:
<details class="code-collapse">
<summary>Show data processing</summary>
Code goes here
</details>
Show data processing
processed_data <- data %>%
filter(!is.na(x), !is.na(y)) %>%
mutate(
x_scaled = scale(x)[,1],
y_scaled = scale(y)[,1],
distance = sqrt(x_scaled^2 + y_scaled^2)
) %>%
arrange(desc(distance))
head(processed_data, 3)
x y group x_scaled y_scaled distance
1 -2.656455 3.1449272 B -2.582179 3.3197211 4.205734
2 -2.993090 -0.8387712 C -2.905445 -0.7676472 3.005144
3 -2.440467 -1.4272253 C -2.374769 -1.3714150 2.742317
Standard markdown
Works as expected: bold, italic, code
, links, lists, etc.
References
Cinelli, Carlos, Andrew Forney, and Judea Pearl. 2020. “A Crash Course in Good and Bad Controls.” SSRN Electronic Journal. https://doi.org/10.2139/ssrn.3689437.