答案 0 :(得分:2)
不要在循环中增长对象,特别是不是data.frame。那非常慢。将它们放入列表并一步rbind
:
res <- lapply(dates, function(month) {
url = sprintf("https://data.police.uk/api/crimes-street/all-crime?poly=53.5803,-2.6882:53.5803,-2.6882:53.2307,-3.2389:53.2307,-3.2389&date=%s", month)
r <- GET(url)
json <- content(r, "text")
fromJSON(txt=json)
})
do.call(rbind, res)