## Loading required package: XML
For this assignment I choose to query the Movie Reviews API.
base_url <- "http://api.nytimes.com/svc/movies/v2/reviews/picks.xml"
response_format <-"xml"
api_key <- "8cf79f3353f439b9af033db83ab98d78%3A13%3A73314805"
url <- sprintf("%s?api-key=%s", base_url, api_key)
Getting Response and placing it into a dataframe.
response <- xmlParse(url)
# get root element of the data set
response_root <- xmlRoot(response)
response_childeren <-xmlChildren(response_root)
response_df <- xmlToDataFrame(response_childeren$results)
# listing column names from the dataframe
colnames(response_df)
## [1] "display_title" "sort_name" "mpaa_rating"
## [4] "critics_pick" "thousand_best" "byline"
## [7] "headline" "capsule_review" "summary_short"
## [10] "publication_date" "opening_date" "dvd_release_date"
## [13] "date_updated" "seo_name" "link"
## [16] "related_urls" "multimedia"
head(response_df)
## display_title sort_name mpaa_rating critics_pick
## 1 The Price We Pay The Price We Pay NR 1
## 2 How to Change the World How to Change the World NR 1
## 3 The Pearl Button The Pearl Button 1
## 4 Bone Tomahawk Bone Tomahawk 1
## 5 Nasty Baby Nasty Baby R 1
## 6 Heart of a Dog Heart of a Dog 1
## thousand_best byline
## 1 0 Andy Webster
## 2 0 Daniel M. Gold
## 3 0 Nicolas Rapold
## 4 0 Jeannette Catsoulis
## 5 0 A. O. Scott
## 6 0 Manohla Dargis
## headline
## 1 Review: <U+0091>The Price We Pay<U+0092> Maps a Web of Offshore Tax Havens
## 2 Review: <U+0091>How to Change the World<U+0092> Traces the Roots of Greenpeace
## 3 Review: <U+0091>The Pearl Button,<U+0092> a Reflection on Chile<U+0092>s Coast and Loss
## 4 Review: <U+0091>Bone Tomahawk<U+0092> Is Western, Horror and Comedy
## 5 Review: In <U+0091>Nasty Baby,<U+0092> Friends Decide to Start a Family. What Could Go Wrong?
## 6 Review: <U+0091>Heart of a Dog,<U+0092> Laurie Anderson<U+0092>s Meditation on Loss
## capsule_review
## 1
## 2
## 3
## 4
## 5
## 6
## summary_short
## 1 Harold Crooks’s documentary shows how the global financial system abets the growing concentration of wealth within a narrow minority.
## 2 This documentary captures the excitement of the make-it-up-as-you-go early days, as well as the stresses that follow when a movement takes off.
## 3 The Chilean filmmaker Patricio Guzmán is known for his nonfiction movies about the dictatorship of Augusto Pinochet.
## 4 A motley band of gunslingers sets out to rescue innocents from cannibals. But don’t count them out: Their leader is Kurt Russell.
## 5 With its haute Bohemian locations and its hectic, hand-held style — this film by Sebastián Silva presents itself as something familiar.
## 6 The performance artist reflects on the deaths in her life, including that of her husband, Lou Reed, and her rat terrier, Lolabelle.
## publication_date opening_date dvd_release_date date_updated
## 1 2015-10-30 2015-10-30 2015-10-30 12:46:04
## 2 2015-10-30 2015-10-30 2015-10-30 12:36:21
## 3 2015-10-23 2015-10-23 2015-10-23 12:44:32
## 4 2015-10-23 2015-10-23 2015-12-29 2015-10-23 09:56:48
## 5 2015-10-23 2015-10-23 2015-12-22 2015-10-22 18:01:29
## 6 2015-10-21 2015-10-21 2015-10-22 18:05:43
## seo_name
## 1 The-Price-We-Pay
## 2 How-to-Change-the-World
## 3 The-Pearl-Button
## 4 Bone-Tomahawk
## 5 Nasty-Baby
## 6 Heart-of-a-Dog
## link
## 1 http://movies.nytimes.com/2015/10/30/movies/review-the-price-we-pay-maps-a-web-of-offshore-tax-havens.htmlRead the New York Times Review of The Price We Pay
## 2 http://movies.nytimes.com/2015/10/30/movies/review-how-to-change-the-world-traces-the-roots-of-greenpeace.htmlRead the New York Times Review of How to Change the World
## 3 http://movies.nytimes.com/2015/10/23/movies/review-the-pearl-button-a-reflection-on-chiles-coast-and-loss.htmlRead the New York Times Review of The Pearl Button
## 4 http://movies.nytimes.com/2015/10/23/movies/review-bone-tomahawk-is-western-horror-and-comedy.htmlRead the New York Times Review of Bone Tomahawk
## 5 http://movies.nytimes.com/2015/10/23/movies/review-in-nasty-baby-friends-decide-to-start-a-family-what-could-go-wrong.htmlRead the New York Times Review of Nasty Baby
## 6 http://movies.nytimes.com/2015/10/21/movies/review-heart-of-a-dog-laurie-andersons-meditation-on-loss.htmlRead the New York Times Review of Heart of a Dog
## related_urls
## 1 http://movies.nytimes.com/movie/477904/The-Price-We-Pay/overviewOverview of The Price We Payhttp://movies.nytimes.com/movie/477904/The-Price-We-Pay/showtimesTickets & Showtimes for The Price We Payhttp://movies.nytimes.com/movie/477904/The-Price-We-Pay/detailsCast, Credits & Awards for The Price We Payhttp://movies.nytimes.com/movie/477904/The-Price-We-Pay/rnrReaders' Reviews of The Price We Payhttp://movies.nytimes.com/movie/477904/The-Price-We-Pay/trailersTrailers & Clips for The Price We Pay
## 2 http://movies.nytimes.com/movie/478699/How-to-Change-the-World/overviewOverview of How to Change the Worldhttp://movies.nytimes.com/movie/478699/How-to-Change-the-World/showtimesTickets & Showtimes for How to Change the Worldhttp://movies.nytimes.com/movie/478699/How-to-Change-the-World/detailsCast, Credits & Awards for How to Change the Worldhttp://movies.nytimes.com/movie/478699/How-to-Change-the-World/rnrReaders' Reviews of How to Change the Worldhttp://movies.nytimes.com/movie/478699/How-to-Change-the-World/trailersTrailers & Clips for How to Change the World
## 3 http://movies.nytimes.com/movie/480070/The-Pearl-Button/overviewOverview of The Pearl Buttonhttp://movies.nytimes.com/movie/480070/The-Pearl-Button/showtimesTickets & Showtimes for The Pearl Buttonhttp://movies.nytimes.com/movie/480070/The-Pearl-Button/detailsCast, Credits & Awards for The Pearl Buttonhttp://movies.nytimes.com/movie/480070/The-Pearl-Button/rnrReaders' Reviews of The Pearl Buttonhttp://movies.nytimes.com/movie/480070/The-Pearl-Button/trailersTrailers & Clips for The Pearl Button
## 4 http://movies.nytimes.com/movie/571301/Bone-Tomahawk/overviewOverview of Bone Tomahawkhttp://movies.nytimes.com/movie/571301/Bone-Tomahawk/showtimesTickets & Showtimes for Bone Tomahawkhttp://movies.nytimes.com/movie/571301/Bone-Tomahawk/detailsCast, Credits & Awards for Bone Tomahawkhttp://movies.nytimes.com/movie/571301/Bone-Tomahawk/rnrReaders' Reviews of Bone Tomahawkhttp://movies.nytimes.com/movie/571301/Bone-Tomahawk/trailersTrailers & Clips for Bone Tomahawk
## 5 http://movies.nytimes.com/movie/478948/Nasty-Baby/overviewOverview of Nasty Babyhttp://movies.nytimes.com/movie/478948/Nasty-Baby/showtimesTickets & Showtimes for Nasty Babyhttp://movies.nytimes.com/movie/478948/Nasty-Baby/detailsCast, Credits & Awards for Nasty Babyhttp://movies.nytimes.com/movie/478948/Nasty-Baby/rnrReaders' Reviews of Nasty Babyhttp://movies.nytimes.com/movie/478948/Nasty-Baby/trailersTrailers & Clips for Nasty Baby
## 6 http://movies.nytimes.com/movie/481700/Heart-of-a-Dog/overviewOverview of Heart of a Doghttp://movies.nytimes.com/movie/481700/Heart-of-a-Dog/showtimesTickets & Showtimes for Heart of a Doghttp://movies.nytimes.com/movie/481700/Heart-of-a-Dog/detailsCast, Credits & Awards for Heart of a Doghttp://movies.nytimes.com/movie/481700/Heart-of-a-Dog/rnrReaders' Reviews of Heart of a Doghttp://movies.nytimes.com/movie/481700/Heart-of-a-Dog/trailersTrailers & Clips for Heart of a Dog
## multimedia
## 1 http://graphics8.nytimes.com/images/2015/10/30/arts/30PRICE/30PRICE-thumbStandard.jpg7575
## 2 http://graphics8.nytimes.com/images/2015/10/30/arts/30HOWTOCHANGE/30HOWTOCHANGE-thumbStandard-v2.jpg7575
## 3 http://graphics8.nytimes.com/images/2015/10/23/arts/23PEARL/23PEARL-thumbStandard.jpg7575
## 4 http://graphics8.nytimes.com/images/2015/10/23/arts/23BONETOM/23BONETOM-thumbStandard.jpg7575
## 5 http://graphics8.nytimes.com/images/2015/10/23/arts/23NASTY/23NASTY-thumbStandard.jpg7575
## 6 http://graphics8.nytimes.com/images/2015/10/21/arts/21HEARTDOG/21HEARTDOG-thumbStandard.jpg7575