-
-
Notifications
You must be signed in to change notification settings - Fork 53
/
01_263 dplyr-summarise.R
27 lines (22 loc) · 942 Bytes
/
01_263 dplyr-summarise.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
# summarise() reduces multiple values down to a single summary.
# install.packages("tidyverse")
library("tidyverse")
read.csv("https://data.giss.nasa.gov/gistemp/tabledata_v4/GLB.Ts+dSST.csv",
skip = 1) %>%
summarise(meanJan = mean(Jan))
read.csv("https://data.giss.nasa.gov/gistemp/tabledata_v4/GLB.Ts+dSST.csv",
skip = 1) %>%
summarise(meanJan = mean(Jan),
maxMar = max(Mar))
# summarize operators
# Center: mean(), median()
# Spread: sd(), IQR(), mad()
# Range: min(), max(), quantile()
# Position: first(), last(), nth(),
# Count: n(), n_distinct()
# Logical: any(), all()
read.csv("https://data.giss.nasa.gov/gistemp/tabledata_v4/GLB.Ts+dSST.csv",
skip = 1) %>%
summarise(sdJan = sd(Jan),
distinctMar = n_distinct(Mar),
n())