Exercise

Import flat files from the web

In the video, you saw that the utils functions to import flat file data, such as read.csv() and read.delim(), are capable of automatically importing from URLs that point to flat files on the web.

You must be wondering whether Hadley Wickham's alternative package, readr, is equally potent. Well, figure it out in this exercise! The URLs for both a .csv file as well as a .delim file are already coded for you. It's up to you to actually import the data. If it works, that is…

Instructions

100 XP
  • Load the readr package. It's already installed on DataCamp's servers.
  • Use url_csv to read in the .csv file it is pointing to. Use the read_csv() function. The .csv contains column names in the first row. Save the resulting data frame as pools.
  • Similarly, use url_delim to read in the online .txt file. Use the read_tsv() function and store the result as potatoes.
  • Print pools and potatoes. Looks correct?