以下の R コードを参照してください。Web サイトからデータを取得するために JSONlite パッケージを使用しています。
>url <- "http://fantasy.premierleague.com/web/api/elements/"
>a<-fromJSON(paste0(url, 1))
>a
次の出力が得られます。
$id
[1] 1
$photo
[1] "59936.jpg"
$web_name
[1] "Szczesny"
$event_explain
list()
$fixture_history
$fixture_history$all
list()
$fixture_history$summary
list()
$season_history
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [,15] [,16] [,17]
[1,] "2008/09" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "45" "0"
[2,] "2009/10" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "45" "0"
[3,] "2010/11" "1350" "0" "0" "6" "19" "0" "1" "0" "1" "0" "45" "0" "0" "0" "43" "62"
[4,] "2011/12" "3420" "0" "0" "13" "49" "0" "1" "0" "2" "0" "82" "8" "469" "0" "59" "139"
[5,] "2012/13" "2250" "0" "0" "10" "24" "0" "1" "0" "1" "0" "71" "3" "314" "0" "53" "102"
[6,] "2013/14" "3330" "0" "0" "16" "41" "0" "1" "0" "2" "0" "113" "4" "475" "194" "59" "157"
[7,] "2014/15" "1498" "0" "0" "3" "21" "0" "0" "0" "1" "0" "44" "0" "172" "215" "52" "47"
今、分析のためにseason_historyデータにデータフレームまたはマトリックスとしてアクセスしたいのですが、どうすればいいですか? ヘッダー付きの最終出力が必要です。
1.web_name
2.$season_history[1,17]
つまり : Szcezesny 47