Skip to content

Instantly share code, notes, and snippets.

@susanBuck
Created February 9, 2026 13:05
Show Gist options
  • Select an option

  • Save susanBuck/570d4c9396281d2ca4ac46f3d43e6f4b to your computer and use it in GitHub Desktop.

Select an option

Save susanBuck/570d4c9396281d2ca4ac46f3d43e6f4b to your computer and use it in GitHub Desktop.
Example Quarto File
---
title: Motor Trend Cars Data
format: html
---
```{r}
#| label: load-packages
#| include: false
library(tidyverse)
```
## Meet the cars
The mtcars dataset contains fuel consumption and design characteristics for `{r} nrow(mtcars)` cars from the 1970s.
This dataset is built into R and is commonly used for teaching data analysis and visualization.
@fig-plot-mtcars shows the relationship between a car’s weight and its fuel efficiency.
```{r}
#| label: fig-plot-mtcars
#| fig-cap: Fuel efficiency vs weight for cars in the mtcars dataset
#| warning: false
#| echo: false
ggplot(mtcars,
aes(x = wt, y = mpg)) +
geom_point(aes(color = factor(cyl)), size = 2) +
labs(
x = "Weight (1000 lbs)",
y = "Miles per gallon",
color = "Number of cylinders"
) +
theme_minimal()
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment