# A tibble: 70 × 4
field year count perc
<chr> <dbl> <dbl> <dbl>
1 Life sciences 2008 18732 0.390
2 Mathematics and computer sciences 2008 3187 0.0664
3 Psychology and social sciences 2008 10684 0.222
4 Engineering 2008 1364 0.0284
5 Education 2008 6561 0.137
6 Humanities and arts 2008 4736 0.0986
7 Other 2008 2762 0.0575
8 Life sciences 2009 19332 0.393
9 Mathematics and computer sciences 2009 3163 0.0644
10 Psychology and social sciences 2009 11074 0.225
# ℹ 60 more rows
PhDs awarded in 2017
# A tibble: 7 × 2
field perc
<chr> <dbl>
1 Life sciences 0.408
2 Mathematics and computer sciences 0.0710
3 Psychology and social sciences 0.236
4 Engineering 0.0412
5 Education 0.0891
6 Humanities and arts 0.0978
7 Other 0.0575
PhDs awarded in 2017
# A tibble: 7 × 2
field perc
<chr> <dbl>
1 Life sciences 0.408
2 Psychology and social sciences 0.236
3 Humanities and arts 0.0978
4 Education 0.0891
5 Mathematics and computer sciences 0.0710
6 Other 0.0575
7 Engineering 0.0412
PhDs awarded in 2017
Field
Percentage
Life sciences
40.8%
Psychology and social sciences
23.6%
Humanities and arts
9.8%
Education
8.9%
Mathematics and computer sciences
7.1%
Other
5.8%
Engineering
4.1%
In the next few slides:
Degrees awarded in 2017
How should this information be displayed? And why?
In a table?
Popular Bachelor's degrees over the years
Year
Education
Engineering
Humanities and arts
Life sciences
Mathematics and computer sciences
Other
Psychology and social sciences
2008
13.7%
2.8%
9.9%
39.0%
6.6%
5.8%
22.2%
2009
13.3%
2.7%
10.0%
39.3%
6.4%
5.7%
22.5%
2010
11.1%
2.9%
10.5%
39.9%
6.8%
5.7%
23.0%
2011
9.6%
3.1%
10.8%
40.5%
6.7%
5.5%
23.7%
2012
9.5%
3.5%
11.0%
40.1%
6.9%
5.4%
23.7%
2013
9.4%
3.9%
10.9%
39.9%
7.0%
5.8%
23.2%
2014
9.0%
4.1%
10.4%
40.5%
7.2%
5.7%
23.1%
2015
9.4%
4.0%
10.3%
40.0%
7.1%
5.6%
23.6%
2016
9.4%
3.9%
10.0%
40.7%
7.2%
5.4%
23.4%
2017
8.9%
4.1%
9.8%
40.8%
7.1%
5.8%
23.6%
Or in a plot?
Tables, the making of
Tables with gt
We will use the gt (Grammar of Tables) package to create tables in R.
The gt philosophy: we can construct a wide variety of useful tables with a cohesive set of table parts.
# A tibble: 7 × 2
field perc
<chr> <dbl>
1 Life sciences 0.408
2 Mathematics and computer scien… 0.0710
3 Psychology and social sciences 0.236
4 Engineering 0.0412
5 Education 0.0891
6 Humanities and arts 0.0978
7 Other 0.0575
# A tibble: 7 × 2
field perc
<chr> <dbl>
1 Life sciences 0.408
2 Psychology and social sciences 0.236
3 Humanities and arts 0.0978
4 Education 0.0891
5 Mathematics and computer scien… 0.0710
6 Other 0.0575
7 Engineering 0.0412