-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathToothGrowth.qmd
More file actions
40 lines (38 loc) · 958 Bytes
/
Copy pathToothGrowth.qmd
File metadata and controls
40 lines (38 loc) · 958 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
---
title: "Tooth Growth"
author: "Thomas Reinke"
format: html
theme: flatly
code-fold: show
highlight-style: a11y
editor: source
---
```{r, include = FALSE}
knitr::opts_chunk$set(
comment = "#",
cache = FALSE,
collapse = TRUE,
error = TRUE,
tidy.opts=list(width.cutoff=65),
echo = TRUE,
message = FALSE,
warning = FALSE
)
library(scales)
library(tidyverse)
theme_set(theme_minimal())
theme_update(panel.grid.minor = element_blank())
theme_update(plot.title = element_text(hjust = 0.5))
```
```{r}
c("lm", "glm", "gam", "loess") |>
map(.x = _, .f = \(method){
ggplot(data = ToothGrowth, mapping = aes(x = len, y = dose, color = supp)) +
geom_point(position = "jitter") +
geom_smooth(se = FALSE, method = method) +
labs(title = method) +
facet_wrap(~ supp, ncol = 1, scales = "fixed") +
scale_color_brewer(type = "qual", palette = "Dark2")
}
)
```