1

I am loading a heavily nested JSON in R -- the seed data on league of legends games. Thanks to another question I was able to open and get a flat data frame (100 x 14167).

library(json)
library(plyr)

data.json <- fromJSON(file = "data/matches1.json")
data.unlist <- lapply(data.json$matches, unlist)

funct <- function(x){
  do.call("data.frame", as.list(x))
}

data.match <- rbind.fill(lapply(data.unlist, funct)) # takes ~15 min
data.frame <- as.data.frame(data.match)

However, most columns have the wrong type, and I run into anomalies when converting. Is there a way of converting the columns automatically to characters/factors or numerics? Or is this wishful thinking? :)

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Vincent
  • 11
  • 1

0 Answers0