5
매우 불쾌한 중첩 JSON에 문제가 있습니다. 이 항목의 수가 증가 두 번째 경기에서 볼 수 있듯이중첩 된 JSON을 데이터 프레임에 구문 분석 R
형식이
{
"matches": [
{
"matchId": 1,
"region": "BR",
"participants": [
{
"participantId": 0,
"teamId": 200,
"stats": {
"winner": true,
"champLevel": 16,
"item0": 3128,
}
{
"matchId": 2,
"region": "BR",
"participants": [
{
"participantId": 0,
"teamId": 201,
"stats": {
"winner": false,
"champLevel": 18,
"item0": 3128,
"item1": 3157,
"item1": 3158,
}
유사하지만 데이터 프레임의 첫 번째 행은 동일한 Collumns는 것입니다 :
MatchId region ... stats.winner stats.champLevel stats.item0 stats.item1 stats.item2
1 BR TRUE 16 3128 1 BR
1 BR TRUE 16 3128 3157 3158
을
첫 번째 행이 초보다 작아서 R이 값을 재활용합니다 ....
전체 데이터를 보려면 내가 data.frame에 JSON 구문 분석하는 방법 510,463,210
:
json으로의 요소 목록에서 제외및
matchData.i <- lapply(json.matchData$matches, function(x){ unlist(x)})
는 데이터 프레임으로 변환 데이터 프레임으로 변환을
matchData <- do.call("rbind", matchData.i)
matchData <- as.data.frame(matchData)
그러나 일부 필드는 NA 여야하지만 wron으로 채워지기 때문에 데이터 프레임이 엉망입니다. g 값.