Exploratory Data Analysis in R
Andrew Bray
Assistant Professor, Reed College
ggplot(cars, aes(x = hwy_mpg)) +
geom_histogram()
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Warning message:
Removed 14 rows containing non-finite values (stat_bin).
ggplot(cars, aes(x = hwy_mpg)) +
geom_histogram() +
facet_wrap(~pickup)
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Warning message:
Removed 14 rows containing non-finite values (stat_bin).
cars2 <- cars %>%
filter(eng_size < 2.0)
ggplot(cars2, aes(x = hwy_mpg)) +
geom_histogram()
cars %>%
filter(eng_size < 2.0) %>%
ggplot(aes(x = hwy_mpg)) +
geom_histogram()
cars %>%
filter(eng_size < 2.0) %>%
ggplot(aes(x = hwy_mpg)) +
geom_histogram()
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
cars %>%
filter(eng_size < 2.0) %>%
ggplot(aes(x = hwy_mpg)) +
geom_histogram(binwidth = 5)
cars %>%
filter(eng_size < 2.0) %>%
ggplot(aes(x = hwy_mpg)) +
geom_density()
cars %>%
filter(eng_size < 2.0) %>%
ggplot(aes(x = hwy_mpg)) +
geom_density(bw = 5)
Exploratory Data Analysis in R