The New York Times web site provides diverse APIs including article search, books, the community, etc. Among them, I got “THE EVENT LISTINGS API” key from the web site. What I want to do is to retrieve Jazz performances in Manhattan between 2015-04-13 and 2015-04-20
library(RCurl)
library(rjson)
library(dplyr)
library(plyr)
library(knitr)
Get URL, including API key and filters(Manhattan, dates between 2015-04-13 and 2015-04-20)
theURL <- "http://api.nytimes.com/svc/events/v2/listings.json?filters=category:Jazz,borough:Manhattan&date_range=2015-04-13:2015-04-20&api-key=95a41335ddef20739e14c93a36b67c0d:5:71828133"
url_json <- getURL(theURL)
data = fromJSON(url_json)
Select the “result” list, which is 4th from the list, and then change the result list to a data frame
str(data)
rdf <- data[[4]]
rdf2 <- ldply(rdf, function(x){data.frame(x)})
Select columns we want to know using “dplyr”
rdf_new <-rdf2%>%
select(event_name, venue_name, street_address, date_time_description, category)
kable(distinct(rdf_new))
| event_name | venue_name | street_address | date_time_description | category |
|---|---|---|---|---|
| Henry Butler | Minton’s | 206 West 118th Street | April 9 and 16 at 7:30 and 9:30 p.m. | Jazz |
| Thar | Cornelia Street Café | 29 Cornelia Street | April 15 at 8:30 p.m. | Jazz |
| Julian Lage Trio | Jazz Standard | 116 East 27th Street | April 14-15 at 7:30 and 10 p.m. | Jazz |
| Kirk Knuffke Trio | Cornelia Street Café | 29 Cornelia Street | April 16 at 8:30 p.m. | Jazz |
| ‘Celebrating Joe Temperley: From Duke to the JLCO’ | Rose Theater, Frederick P. Rose Hall, Jazz at Lincoln Center | Broadway | April 16-18 at 8 p.m. | Jazz |
| If Django Met Sidney | Symphony Space | 2537 Broadway | April 20 at 7:15 p.m. | Jazz |
| James Carter Organ Trio | Birdland | 315 West 44th Street | April 14-18 at 8:30 and 11 p.m. | Jazz |
| Respect Sextet | Greenwich House Music School | 46 Barrow Street | April 17 at 7:30 p.m. | Jazz |
| Jeremy Pelt Quintet | Smoke | 2751 Broadway | April 17-19 at 7, 9 and 10:30 p.m. | Jazz |
| J.C. Hopkins Biggish Band | Minton’s | 206 West 118th Street | April 18 at 6 p.m. | Jazz |
| Kris Davis’ Capricorn Climber | The Jazz Gallery | 1160 Broadway | April 17-18 at 8 and 10 p.m. | Jazz |
| Briggan Krauss H-Alpha | Roulette | 509 Atlantic Avenue | April 20 at 8 p.m. | Jazz |
| Secret Keeper | Cornelia Street Café | 29 Cornelia Street | April 17 at 9 and 10:30 p.m. | Jazz |
| Javon Jackson Quartet | Village Vanguard | 178 Seventh Avenue South | April 14-19 at 8:30 and 10:30 p.m. | Jazz |
| Samba Jazz and the Music of Jobim | Dizzy’s Club Coca-Cola, Frederick P. Rose Hall, Jazz at Lincoln Center | Broadway | April 16-19 at 7:30 and 9:30 p.m. | Jazz |
| Tomas Fujiwara and the Hook Up | Cornelia Street Café | 29 Cornelia Street | April 18 at 9 and 10:30 p.m. | Jazz |
| Marc Cary Rhodes Ahead | Ginny’s Supper Club | 310 Lenox Avenue | April 17-18 at 7:30 and 9:30 p.m. | Jazz |
| Charles Lloyd: Wild Man Dance Suite | Metropolitan Museum of Art | Fifth Avenue | April 18 at 8 p.m. | Jazz |
| National Endowment for the Arts Jazz Master Ceremony | Rose Theater, Frederick P. Rose Hall, Jazz at Lincoln Center | Broadway | April 20 at 7:30 p.m. | Jazz |
| Roy Hargrove Quintet | Blue Note | 131 West Third Street | April 14-19 at 8 and 10:30 p.m. | Jazz |