4.13 Exercise: Scraping data from APIs
Meetup is a website on which users can organize meetings. Find out if meetup has an API and whether there are any R packages that may help analyzing data from this API. Try to scrape some meetup data using the API.
In the previous lab “Lab: Scraping data from APIs” we discussed the New York Times API and the role of functions/loops in collecting data from such APIs.
- Please create an account in order to get an API key: https://developer.nytimes.com/
- In the lab we defined two functions
nyt_count
andnyt_years_count
(which uses/requiresnyt_count
). First, closely inspect the two functions, i.e., what steps they contain etc. Second, try to modify the functionnyt_years_count
so that you can feed it with a vector of search terms (instead of a single search term). The new function should return a data frame that contains the search terms as variables and the counts (over the years) in the rows (if you store results in a lists you can useas.data.frame(LIST)
to convert the list to a dataframe ). Call this new functionnyt_years_count_qlist
.