Line plots
I N T R O D U C T I O N TO T H E T I DY V E R S E
David Robinson
Chief Data Scientist, DataCamp
INTRODUCTION TO THE TIDYVERSE
Types of plots
INTRODUCTION TO THE TIDYVERSE
Scatter vs line plot
geom_point() geom_line()
INTRODUCTION TO THE TIDYVERSE
Line plot
ggplot(year_continent, aes(x = year, y = meanLifeExp, color = continent)) +
geom_line() +
expand_limits(y = 0)
INTRODUCTION TO THE TIDYVERSE
Let's practice!
I N T R O D U C T I O N TO T H E T I DY V E R S E
Bar plots
I N T R O D U C T I O N TO T H E T I DY V E R S E
David Robinson
Chief Data Scientist, DataCamp
Summarizing by continent
by_continent <- gapminder %>%
filter(year == 2007) %>%
group_by(continent) %>%
summarize(meanLifeExp = mean(lifeExp))
by_continent
# A tibble: 5 x 2
continent meanLifeExp
<fctr> <dbl>
1 Africa 54.80604
2 Americas 73.60812
3 Asia 70.72848
4 Europe 77.64860
5 Oceania 80.71950
INTRODUCTION TO THE TIDYVERSE
Bar plot
ggplot(by_continent, aes(x = continent, y = meanLifeExp)) +
geom_col()
INTRODUCTION TO THE TIDYVERSE
Let's practice!
I N T R O D U C T I O N TO T H E T I DY V E R S E
Histograms
I N T R O D U C T I O N TO T H E T I DY V E R S E
David Robinson
Chief Data Scientist, DataCamp
Histogram
ggplot(gapminder_2007, aes(x = lifeExp)) +
geom_histogram()
INTRODUCTION TO THE TIDYVERSE
Adjusting bin width
ggplot(gapminder_2007, aes(x = lifeExp)) +
geom_histogram(binwidth = 5)
INTRODUCTION TO THE TIDYVERSE
Log x-axis
scale_x_log10()
INTRODUCTION TO THE TIDYVERSE
Let's practice!
I N T R O D U C T I O N TO T H E T I DY V E R S E
Box plots
I N T R O D U C T I O N TO T H E T I DY V E R S E
David Robinson
Chief Data Scientist, DataCamp
Histograms
ggplot(gapminder_2007, aes(x = lifeExp)) +
geom_histogram()
INTRODUCTION TO THE TIDYVERSE
Box plots
ggplot(gapminder_2007, aes(x = continent, y = lifeExp)) +
geom_boxplot()
INTRODUCTION TO THE TIDYVERSE
Histogram vs box plot
INTRODUCTION TO THE TIDYVERSE
Let's practice!
I N T R O D U C T I O N TO T H E T I DY V E R S E
Conclusion
I N T R O D U C T I O N TO T H E T I DY V E R S E
David Robinson
Chief Data Scientist, DataCamp
Transforming and visualizing data with R
INTRODUCTION TO THE TIDYVERSE
Next steps: Data visualization
Data visualization with ggplot2
INTRODUCTION TO THE TIDYVERSE
Next steps: Data manipulation
Data manipulation with dplyr
INTRODUCTION TO THE TIDYVERSE
Next steps: Importing and cleaning data
Importing and cleaning data
INTRODUCTION TO THE TIDYVERSE
Next steps: Practice!
Exploratory Data Analysis in R: Case Study
INTRODUCTION TO THE TIDYVERSE
Enjoy your data
science journey!
I N T R O D U C T I O N TO T H E T I DY V E R S E