l i b r a r y ( t i d y r ) n e w d a t a <
- g
a t h e r ( s t u d e n t s , G r
- u
p , N u m b e r , 2 : 7 )
What is this line of code doing? Answer: combine columns 2 to 7 of dataset s t u d e n t s into two columns named Group and Number How many Groups are there in dataset s t u d e n t s ? Answer: 6 groups
An introduction to WS 2019/2020
- Dr. Noémie Becker
- Dr. Eliza Argyridou
Special thanks to:
- Dr. Benedikt Holtmann and Dr. Sonja Grath for sharing slides for this lecture
Data visualization and graphics
3
What you should know after day 6
Review: Rearranging and manipulating data Graphics with base R
- Histograms
- Scatterplots
- Boxplots
Saving plots Graphics with ggplot2 4
Graphics with base R
Simple graphics using plotting functions in the graphics package
- Base R, installed by default
- Easy and quick to type
- Wide variety of functions
Functjon Descriptjon hist() Histograms plot() Scatuerplots, etc. boxplot() Box- and whisker plots barplot() Bar- and column charts dotchart() Cleveland dot plots contour Contour of a surface (2D) pie() Circular pie chart …
5
What you should know after day 6
Review: Rearranging and manipulating data Graphics with base R
- Histograms
- Scatterplots
- Boxplots
Saving plots Graphics with ggplot2 6
Graphics with base R
Creating a histogram with hist() Example 1: h i s t ( S p a r r
- w
s $ T a r s u s )
Hist
- gra
m of Sparrows$Tarsus
S p a r r
- w
s $ T a r s u s F r e q u e n c y 1 9 2 0 2 1 2 2 2 3 2 4 2 5 5 1 1 5 2