Grouping and summarizing Flashcards

(5 cards)

1
Q

Which function turns many observations into one data point?

A

summarize()

Ex: my_tibble %>%
summarize(meanLifeExp =
mean(lifeExp))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How can you summarize multiple things at the same time?

A

Using commas.

Ex: my_tibble %>%
summarize(meanLifeExp =
mean(lifeExp),
medianPop = median(pop))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which function tells dplyr to summarize within groups rather than summarizing the entire data set?

A

group_by()

Ex: my_tibble %>%
group_by(year) %>%
summarize(meanLifeExp = mean(lifeExp))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How can you group by multiple things at the same time?

A

Using commas.

Ex: my_tibble %>%
group_by(year, continent) %>%
summarize(meanLifeExp =
mean(lifeExp),
medianPop = median(pop))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which function allows you to specify where the x or y axis’ should begin or end?

A

expand_limits()

Ex: … geom_point() +
expand_limits(y = 0)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly