1. Learn
  2. /
  3. Courses
  4. /
  5. How to work with Quandl in R

Exercise

Searching a Quandl dataset in R

Obviously, you do not want to go to the Quandl website every single time you need a dataset in R. Luckily, it is possible to search Quandl datasets using R as follows:

Quandl.search(query = "Search Term", page = int,
              source = "Specific source to search",
              silent = TRUE|FALSE)

query is the only mandatory argument and represents the term you wish to search for on Quandl. page is which page of search result you wish to return (default = 1), and source lets you choose the specific source you wish to search for. By putting silent to FALSE you see the first 3 results printed to the console. If silent is set to TRUE it does not print anything to screen.

What if you want to see all search results on the first page? You can assign the result of the Quandl.search() function to a variable, and then print this variable to find out about all search results.

Instructions

100 XP
  • Given the recent popularity of Bitcoins, you want to do a search for Bitcoin. You only want the first 3 results from the first page. You have no idea on what specific source to search for so there's no need to use the source parameter. Assign the result of this search to the variable results.
  • Print out the results in a structured manner using the str() function.
  • Assign the data set related to the fourth search result, corresponding to the code "BCHAIN/TOTBC", to the variable BitCoin.