Exercise 1: Scraping tables
- For your project you need some data on Swiss cantons namely what their capital is, the population etc. Lucky you.. Wikipedia actually has the data you need on the website: https://en.wikipedia.org/wiki/Cantons_of_Switzerland. Scrape the table that contains the cantons and various statistics about them.
- Rename the Population column “population” and the Area column “area”. (Tip: ?dplyr::rename)
- You notice that the data in those columns is not numeric (Q: How do we check for that?). Also there seem to be commas in those columns. Get rid of those commas and convert those columns into numeric format. (Tip: ?gsub)
- Finally, we would like to know whether population correlates with area. How could we test that? What would you expect?