forked from stephaniehicks/jhustatcomputing2022
-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.R
66 lines (44 loc) · 1.03 KB
/
index.R
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#| fig-width: 5
#| fig-height: 5
#| fig-cap: "Scatterplot with loess curve"
data(airquality)
with(airquality, {
plot(Temp, Ozone)
lines(loess.smooth(Temp, Ozone))
})
#| fig-width: 5
#| fig-height: 5
#| fig-cap: "Scatterplot with loess curve"
data(airquality)
with(airquality, {
plot(Temp, Ozone, main = "my plot")
lines(loess.smooth(Temp, Ozone))
})
#| fig-width: 5
#| fig-height: 5
#| fig-cap: "Base plot with title"
data(cars)
## Create the plot / draw canvas
with(cars, plot(speed, dist))
## Add annotation
title("Speed vs. Stopping distance")
library(lattice)
#| fig-width: 8
#| fig-height: 4
#| fig-cap: "Lattice plot"
state <- data.frame(state.x77, region = state.region)
xyplot(Life.Exp ~ Income | region, data = state, layout = c(4, 1))
#| eval: false
## install.packages("ggplot2")
library(ggplot2)
#| message: false
#| fig-width: 6
#| fig-height: 5
#| fig-cap: "ggplot2 plot"
library(tidyverse)
data(mpg)
mpg %>%
ggplot(aes(displ, hwy)) +
geom_point()
options(width = 120)
sessioninfo::session_info()