我试图从网址中检索JSON数据,但似乎数据格式错误:
#this is what I have
ID <- c(1,1,2,3,3,3)
Date <- as.Date (c("2015/01/01","2016/01/03", "2011/03/01", "2015/01/09", "2017/12/11","2016/09/09" ))
Score <- c(5,15,2,6,12,18)
df <- data.frame(ID, Date, Score)
df
#this is what i want
ID2 <- c(1,2,3)
Date1 <- as.Date (c("2015/01/01","2011/03/01","2015/01/09"))
Date2 <- as.Date (c("2016/01/03", NA, "2017/12/11"))
Date3 <- as.Date (c(NA, NA,"2016/09/09"))
Score1 <- c(5,2,6)
Score2 <- c(15,NA,12)
Score3 <- c("NA","NA",18)
df2 <- data.frame (ID2, Date1, Date2, Date3, Score1, Score2, Score3)
df2
来自此网址:JSON URL
有没有办法修改JSON数据,以便正确解析?