8.7 Exercise 2.1: Scraping (many) tables
- For your project you would like to know how the average population has increased in Switzerland. Search for data and plot it.
- Source: https://en.wikipedia.org/wiki/Demographics_of_Switzerland
- Use the
html_nodes
function that we used above.
- Rename the variables.
- Try to produce the plot shown below.
## 'data.frame': 118 obs. of 9 variables:
## $ time : chr "1900" "1901" "1902" "1903" ...
## $ avpopulation : chr "3,300" "3,341" "3,384" "3,428" ...
## $ Live births : chr "94,316" "97,028" "96,480" "93,824" ...
## $ Deaths : chr "63,606" "60,018" "57,702" "59,626" ...
## $ Natural change : chr "30,710" "37,010" "38,778" "34,198" ...
## $ Crude birth rate (per 1000): num 28.6 29 28.5 27.4 27.3 26.9 26.9 26.2 26.4 25.5 ...
## $ Crude death rate (per 1000): num 19.3 18 17.1 17.4 17.5 17.6 16.6 16.4 15.8 16.1 ...
## $ Natural change (per 1000) : num 9.3 11.1 11.5 10 9.8 9.3 10.2 9.8 10.6 9.4 ...
## $ Fertility rates : num NA NA NA NA NA NA NA NA NA NA ...
Q: What kind of evolution is that? What happened at the time of the bumps?