我尝试从维基百科中获取最近90天的查看数据
library(RJSONIO)
library(RCurl)
library(ggplot2)
#download the last 90 days of PageView statistics:
page <- "USA"
raw_data <- getURL(paste("http://stats.grok.se/json/en/latest90/", page, sep=""))
data <- fromJSON(raw_data)
views <- data.frame(timestamp=paste(names(data$daily_views), " 12:00:00", sep=""), stringsAsFactors=F)
views$count <- data$daily_views
views$timestamp <- as.POSIXlt(views$timestamp) # Transform to POSIX datetime
views <- views[order(views$timestamp),]
产生错误输出:
Error in `$<-.data.frame`(`*tmp*`, "count", value = list()) :
replacement has 0 rows, data has 1
我错过了什么吗?