require("jsonlite")
## Loading required package: jsonlite
f1 <- fromJSON('http://ergast.com/api/f1/1957/results.json')
f1
## $MRData
## $MRData$xmlns
## [1] "http://ergast.com/mrd/1.4"
## 
## $MRData$series
## [1] "f1"
## 
## $MRData$url
## [1] "http://ergast.com/api/f1/1957/results.json"
## 
## $MRData$limit
## [1] "30"
## 
## $MRData$offset
## [1] "0"
## 
## $MRData$total
## [1] "171"
## 
## $MRData$RaceTable
## $MRData$RaceTable$season
## [1] "1957"
## 
## $MRData$RaceTable$Races
##   season round                                                    url
## 1   1957     1 http://en.wikipedia.org/wiki/1957_Argentine_Grand_Prix
## 2   1957     2    http://en.wikipedia.org/wiki/1957_Monaco_Grand_Prix
##               raceName Circuit.circuitId
## 1 Argentine Grand Prix            galvez
## 2    Monaco Grand Prix            monaco
##                                                             Circuit.url
## 1 http://en.wikipedia.org/wiki/Aut%C3%B3dromo_Oscar_Alfredo_G%C3%A1lvez
## 2                        http://en.wikipedia.org/wiki/Circuit_de_Monaco
##             Circuit.circuitName Circuit.Location.lat Circuit.Location.long
## 1 Autódromo Juan y Oscar Gálvez             -34.6943              -58.4593
## 2             Circuit de Monaco              43.7347               7.42056
##   Circuit.Location.locality Circuit.Location.country       date
## 1              Buenos Aires                Argentina 1957-01-13
## 2               Monte-Carlo                   Monaco 1957-05-19
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         Results
## 1 2, 6, 8, 22, 20, 20, 18, 18, 18, 24, 4, 26, 28, 14, 16, 12, 10, 1, 2, 3, 4, 5, 5, 6, 6, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1, 2, 3, 4, 5, 5, 6, 6, 6, 7, 8, 9, 10, R, R, R, R, 8, 6, 4, 3, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, fangio, behra, menditeguy, schell, gonzalez, portago, perdisa, collins, trips, bonnier, moss, tomaso, piotti, castellotti, hawthorn, musso, collins, http://en.wikipedia.org/wiki/Juan_Manuel_Fangio, http://en.wikipedia.org/wiki/Jean_Behra, http://en.wikipedia.org/wiki/Carlos_Menditeguy, http://en.wikipedia.org/wiki/Harry_Schell, http://en.wikipedia.org/wiki/Jos%C3%A9_Froil%C3%A1n_Gonz%C3%A1lez, http://en.wikipedia.org/wiki/Alfonso_de_Portago, http://en.wikipedia.org/wiki/Cesare_Perdisa, http://en.wikipedia.org/wiki/Peter_Collins_(racing_driver), http://en.wikipedia.org/wiki/Wolfgang_Graf_Berghe_von_Trips, http://en.wikipedia.org/wiki/Joakim_Bonnier, http://en.wikipedia.org/wiki/Stirling_Moss, http://en.wikipedia.org/wiki/Alessandro_de_Tomaso, http://en.wikipedia.org/wiki/Luigi_Piotti, http://en.wikipedia.org/wiki/Eugenio_Castellotti, http://en.wikipedia.org/wiki/Mike_Hawthorn, http://en.wikipedia.org/wiki/Luigi_Musso, http://en.wikipedia.org/wiki/Peter_Collins_(racing_driver), Juan, Jean, Carlos, Harry, José Froilán, Alfonso, Cesare, Peter, Wolfgang, Jo, Stirling, Alessandro, Luigi, Eugenio, Mike, Luigi, Peter, Fangio, Behra, Menditeguy, Schell, González, de Portago, Perdisa, Collins, von Trips, Bonnier, Moss, de Tomaso, Piotti, Castellotti, Hawthorn, Musso, Collins, 1911-06-24, 1921-02-16, 1914-08-10, 1921-06-29, 1922-10-05, 1928-10-11, 1932-10-21, 1931-11-06, 1928-05-04, 1930-01-31, 1929-09-17, 1928-07-10, 1913-10-27, 1930-10-10, 1929-04-10, 1924-07-28, 1931-11-06, Argentine, French, Argentine, American, Argentine, Spanish, Italian, British, German, Swedish, British, Argentine-Italian, Italian, Italian, British, Italian, British, maserati, maserati, maserati, maserati, ferrari, ferrari, ferrari, ferrari, ferrari, maserati, maserati, ferrari, maserati, ferrari, ferrari, ferrari, ferrari, http://en.wikipedia.org/wiki/Maserati, http://en.wikipedia.org/wiki/Maserati, http://en.wikipedia.org/wiki/Maserati, http://en.wikipedia.org/wiki/Maserati, http://en.wikipedia.org/wiki/Scuderia_Ferrari, http://en.wikipedia.org/wiki/Scuderia_Ferrari, http://en.wikipedia.org/wiki/Scuderia_Ferrari, http://en.wikipedia.org/wiki/Scuderia_Ferrari, http://en.wikipedia.org/wiki/Scuderia_Ferrari, http://en.wikipedia.org/wiki/Maserati, http://en.wikipedia.org/wiki/Maserati, http://en.wikipedia.org/wiki/Scuderia_Ferrari, http://en.wikipedia.org/wiki/Maserati, http://en.wikipedia.org/wiki/Scuderia_Ferrari, http://en.wikipedia.org/wiki/Scuderia_Ferrari, http://en.wikipedia.org/wiki/Scuderia_Ferrari, http://en.wikipedia.org/wiki/Scuderia_Ferrari, Maserati, Maserati, Maserati, Maserati, Ferrari, Ferrari, Ferrari, Ferrari, Ferrari, Maserati, Maserati, Ferrari, Maserati, Ferrari, Ferrari, Ferrari, Ferrari, Italian, Italian, Italian, Italian, Italian, Italian, Italian, Italian, Italian, Italian, Italian, Italian, Italian, Italian, Italian, Italian, Italian, 2, 3, 8, 9, 10, 10, 11, 11, 11, 13, 1, 12, 14, 4, 7, 6, 5, 100, 100, 99, 98, 98, 98, 98, 98, 98, 95, 93, 91, 90, 75, 35, 31, 26, Finished, Finished, +1 Lap, +2 Laps, +2 Laps, +2 Laps, +2 Laps, +2 Laps, +2 Laps, +5 Laps, +7 Laps, +9 Laps, +10 Laps, Wheel, Clutch, Clutch, Clutch, 10855900, 10874200, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 3:00:55.9, +18.3, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA
## 2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           32, 20, 2, 10, 30, 14, 24, 24, 34, 34, 6, 36, 12, 1, 2, 3, 4, 5, 6, 7, 7, 8, 8, 9, 10, 11, 1, 2, 3, 4, 5, 6, R, R, R, R, R, R, R, 9, 6, 4, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, fangio, brooks, gregory, lewis-evans, trintignant, jack_brabham, hawthorn, trips, schell, scarlatti, flockhart, menditeguy, bueb, http://en.wikipedia.org/wiki/Juan_Manuel_Fangio, http://en.wikipedia.org/wiki/Tony_Brooks, http://en.wikipedia.org/wiki/Masten_Gregory, http://en.wikipedia.org/wiki/Stuart_Lewis-Evans, http://en.wikipedia.org/wiki/Maurice_Trintignant, http://en.wikipedia.org/wiki/Jack_Brabham, http://en.wikipedia.org/wiki/Mike_Hawthorn, http://en.wikipedia.org/wiki/Wolfgang_Graf_Berghe_von_Trips, http://en.wikipedia.org/wiki/Harry_Schell, http://en.wikipedia.org/wiki/Giorgio_Scarlatti, http://en.wikipedia.org/wiki/Ron_Flockhart_(auto_racing), http://en.wikipedia.org/wiki/Carlos_Menditeguy, http://en.wikipedia.org/wiki/Ivor_Bueb, Juan, Tony, Masten, Stuart, Maurice, Jack, Mike, Wolfgang, Harry, Giorgio, Ron, Carlos, Ivor, Fangio, Brooks, Gregory, Lewis-Evans, Trintignant, Brabham, Hawthorn, von Trips, Schell, Scarlatti, Flockhart, Menditeguy, Bueb, 1911-06-24, 1932-02-25, 1932-02-29, 1930-04-20, 1917-10-30, 1926-04-02, 1929-04-10, 1928-05-04, 1921-06-29, 1921-10-02, 1923-06-16, 1914-08-10, 1923-06-06, Argentine, British, American, British, French, Australian, British, German, American, Italian, British, Argentine, British, maserati, vanwall, maserati, connaught, ferrari, cooper, ferrari, ferrari, maserati, maserati, brm, maserati, connaught, http://en.wikipedia.org/wiki/Maserati, http://en.wikipedia.org/wiki/Vanwall, http://en.wikipedia.org/wiki/Maserati, http://en.wikipedia.org/wiki/Connaught_Engineering, http://en.wikipedia.org/wiki/Scuderia_Ferrari, http://en.wikipedia.org/wiki/Cooper_Car_Company, http://en.wikipedia.org/wiki/Scuderia_Ferrari, http://en.wikipedia.org/wiki/Scuderia_Ferrari, http://en.wikipedia.org/wiki/Maserati, http://en.wikipedia.org/wiki/Maserati, http://en.wikipedia.org/wiki/BRM, http://en.wikipedia.org/wiki/Maserati, http://en.wikipedia.org/wiki/Connaught_Engineering, Maserati, Vanwall, Maserati, Connaught, Ferrari, Cooper, Ferrari, Ferrari, Maserati, Maserati, BRM, Maserati, Connaught, Italian, British, Italian, British, Italian, British, Italian, Italian, Italian, Italian, British, Italian, British, 1, 4, 10, 13, 6, 15, 9, 9, 14, 14, 11, 7, 16, 105, 105, 103, 102, 100, 100, 95, 95, 64, 64, 60, 51, 47, Finished, Finished, +2 Laps, +3 Laps, +5 Laps, +5 Laps, Engine, Engine, Oil leak, Oil leak, Engine, Spun off, Fuel leak, 11412800, 11438000, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 3:10:12.8, +25.2, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA
str(f1)
## List of 1
##  $ MRData:List of 7
##   ..$ xmlns    : chr "http://ergast.com/mrd/1.4"
##   ..$ series   : chr "f1"
##   ..$ url      : chr "http://ergast.com/api/f1/1957/results.json"
##   ..$ limit    : chr "30"
##   ..$ offset   : chr "0"
##   ..$ total    : chr "171"
##   ..$ RaceTable:List of 2
##   .. ..$ season: chr "1957"
##   .. ..$ Races :'data.frame':    2 obs. of  7 variables:
##   .. .. ..$ season  : chr [1:2] "1957" "1957"
##   .. .. ..$ round   : chr [1:2] "1" "2"
##   .. .. ..$ url     : chr [1:2] "http://en.wikipedia.org/wiki/1957_Argentine_Grand_Prix" "http://en.wikipedia.org/wiki/1957_Monaco_Grand_Prix"
##   .. .. ..$ raceName: chr [1:2] "Argentine Grand Prix" "Monaco Grand Prix"
##   .. .. ..$ Circuit :'data.frame':   2 obs. of  4 variables:
##   .. .. .. ..$ circuitId  : chr [1:2] "galvez" "monaco"
##   .. .. .. ..$ url        : chr [1:2] "http://en.wikipedia.org/wiki/Aut%C3%B3dromo_Oscar_Alfredo_G%C3%A1lvez" "http://en.wikipedia.org/wiki/Circuit_de_Monaco"
##   .. .. .. ..$ circuitName: chr [1:2] "Autódromo Juan y Oscar Gálvez" "Circuit de Monaco"
##   .. .. .. ..$ Location   :'data.frame': 2 obs. of  4 variables:
##   .. .. .. .. ..$ lat     : chr [1:2] "-34.6943" "43.7347"
##   .. .. .. .. ..$ long    : chr [1:2] "-58.4593" "7.42056"
##   .. .. .. .. ..$ locality: chr [1:2] "Buenos Aires" "Monte-Carlo"
##   .. .. .. .. ..$ country : chr [1:2] "Argentina" "Monaco"
##   .. .. ..$ date    : chr [1:2] "1957-01-13" "1957-05-19"
##   .. .. ..$ Results :List of 2
##   .. .. .. ..$ :'data.frame':    17 obs. of  10 variables:
##   .. .. .. .. ..$ number      : chr [1:17] "2" "6" "8" "22" ...
##   .. .. .. .. ..$ position    : chr [1:17] "1" "2" "3" "4" ...
##   .. .. .. .. ..$ positionText: chr [1:17] "1" "2" "3" "4" ...
##   .. .. .. .. ..$ points      : chr [1:17] "8" "6" "4" "3" ...
##   .. .. .. .. ..$ Driver      :'data.frame': 17 obs. of  6 variables:
##   .. .. .. .. .. ..$ driverId   : chr [1:17] "fangio" "behra" "menditeguy" "schell" ...
##   .. .. .. .. .. ..$ url        : chr [1:17] "http://en.wikipedia.org/wiki/Juan_Manuel_Fangio" "http://en.wikipedia.org/wiki/Jean_Behra" "http://en.wikipedia.org/wiki/Carlos_Menditeguy" "http://en.wikipedia.org/wiki/Harry_Schell" ...
##   .. .. .. .. .. ..$ givenName  : chr [1:17] "Juan" "Jean" "Carlos" "Harry" ...
##   .. .. .. .. .. ..$ familyName : chr [1:17] "Fangio" "Behra" "Menditeguy" "Schell" ...
##   .. .. .. .. .. ..$ dateOfBirth: chr [1:17] "1911-06-24" "1921-02-16" "1914-08-10" "1921-06-29" ...
##   .. .. .. .. .. ..$ nationality: chr [1:17] "Argentine" "French" "Argentine" "American" ...
##   .. .. .. .. ..$ Constructor :'data.frame': 17 obs. of  4 variables:
##   .. .. .. .. .. ..$ constructorId: chr [1:17] "maserati" "maserati" "maserati" "maserati" ...
##   .. .. .. .. .. ..$ url          : chr [1:17] "http://en.wikipedia.org/wiki/Maserati" "http://en.wikipedia.org/wiki/Maserati" "http://en.wikipedia.org/wiki/Maserati" "http://en.wikipedia.org/wiki/Maserati" ...
##   .. .. .. .. .. ..$ name         : chr [1:17] "Maserati" "Maserati" "Maserati" "Maserati" ...
##   .. .. .. .. .. ..$ nationality  : chr [1:17] "Italian" "Italian" "Italian" "Italian" ...
##   .. .. .. .. ..$ grid        : chr [1:17] "2" "3" "8" "9" ...
##   .. .. .. .. ..$ laps        : chr [1:17] "100" "100" "99" "98" ...
##   .. .. .. .. ..$ status      : chr [1:17] "Finished" "Finished" "+1 Lap" "+2 Laps" ...
##   .. .. .. .. ..$ Time        :'data.frame': 17 obs. of  2 variables:
##   .. .. .. .. .. ..$ millis: chr [1:17] "10855900" "10874200" NA NA ...
##   .. .. .. .. .. ..$ time  : chr [1:17] "3:00:55.9" "+18.3" NA NA ...
##   .. .. .. ..$ :'data.frame':    13 obs. of  10 variables:
##   .. .. .. .. ..$ number      : chr [1:13] "32" "20" "2" "10" ...
##   .. .. .. .. ..$ position    : chr [1:13] "1" "2" "3" "4" ...
##   .. .. .. .. ..$ positionText: chr [1:13] "1" "2" "3" "4" ...
##   .. .. .. .. ..$ points      : chr [1:13] "9" "6" "4" "3" ...
##   .. .. .. .. ..$ Driver      :'data.frame': 13 obs. of  6 variables:
##   .. .. .. .. .. ..$ driverId   : chr [1:13] "fangio" "brooks" "gregory" "lewis-evans" ...
##   .. .. .. .. .. ..$ url        : chr [1:13] "http://en.wikipedia.org/wiki/Juan_Manuel_Fangio" "http://en.wikipedia.org/wiki/Tony_Brooks" "http://en.wikipedia.org/wiki/Masten_Gregory" "http://en.wikipedia.org/wiki/Stuart_Lewis-Evans" ...
##   .. .. .. .. .. ..$ givenName  : chr [1:13] "Juan" "Tony" "Masten" "Stuart" ...
##   .. .. .. .. .. ..$ familyName : chr [1:13] "Fangio" "Brooks" "Gregory" "Lewis-Evans" ...
##   .. .. .. .. .. ..$ dateOfBirth: chr [1:13] "1911-06-24" "1932-02-25" "1932-02-29" "1930-04-20" ...
##   .. .. .. .. .. ..$ nationality: chr [1:13] "Argentine" "British" "American" "British" ...
##   .. .. .. .. ..$ Constructor :'data.frame': 13 obs. of  4 variables:
##   .. .. .. .. .. ..$ constructorId: chr [1:13] "maserati" "vanwall" "maserati" "connaught" ...
##   .. .. .. .. .. ..$ url          : chr [1:13] "http://en.wikipedia.org/wiki/Maserati" "http://en.wikipedia.org/wiki/Vanwall" "http://en.wikipedia.org/wiki/Maserati" "http://en.wikipedia.org/wiki/Connaught_Engineering" ...
##   .. .. .. .. .. ..$ name         : chr [1:13] "Maserati" "Vanwall" "Maserati" "Connaught" ...
##   .. .. .. .. .. ..$ nationality  : chr [1:13] "Italian" "British" "Italian" "British" ...
##   .. .. .. .. ..$ grid        : chr [1:13] "1" "4" "10" "13" ...
##   .. .. .. .. ..$ laps        : chr [1:13] "105" "105" "103" "102" ...
##   .. .. .. .. ..$ status      : chr [1:13] "Finished" "Finished" "+2 Laps" "+3 Laps" ...
##   .. .. .. .. ..$ Time        :'data.frame': 13 obs. of  2 variables:
##   .. .. .. .. .. ..$ millis: chr [1:13] "11412800" "11438000" NA NA ...
##   .. .. .. .. .. ..$ time  : chr [1:13] "3:10:12.8" "+25.2" NA NA ...
# Convert R list to data.frame
dr <- f1$MRData$RaceTable$Races$Results[[1]]$Driver
colnames(dr)
## [1] "driverId"    "url"         "givenName"   "familyName"  "dateOfBirth"
## [6] "nationality"
dr[1:5, c("givenName", "familyName", "dateOfBirth", "nationality")]
##      givenName familyName dateOfBirth nationality
## 1         Juan     Fangio  1911-06-24   Argentine
## 2         Jean      Behra  1921-02-16      French
## 3       Carlos Menditeguy  1914-08-10   Argentine
## 4        Harry     Schell  1921-06-29    American
## 5 José Froilán   González  1922-10-05   Argentine