0

I'm looking to pull data from open data.

https://data.cityofnewyork.us/Transportation/For-Hire-Vehicles-FHV-Active-and-Inactive-Vehicles/8wbx-tsch

But I noticed, my code is producing only 1000 rows of data when I now there are more. Where am I going wrong with this?

#libraries
library(RJSONIO)

#pull data
a <- fromJSON("https://data.cityofnewyork.us/resource/k5sk-y8y9.json?$query= SELECT Base_number, Base_name, Base_type, Base_Address")

#loop to extract (I'm aware that sapply or 
#lapply may be better functions, how would I approach this issue with those?)
empty_a = NULL
for (i in a) {
  print(i)
  empty_a = rbind(empty_a, i)
}

empty_a = as.data.frame(empty_a)
LoF10
  • 1,907
  • 1
  • 23
  • 64
  • It's an Open Data portal so it has a Socrata API. Why not just do: `RSocrata::read.socrata("https://data.cityofnewyork.us/resource/k5sk-y8y9.json")` ? – hrbrmstr Nov 28 '16 at 17:32
  • I'm receiving an error: "Error in curl::curl_fetch_memory(url, handle = handle) : Failure when receiving data from the peer" when using rscocrata so I rather use RJSONIO or jsonlite – LoF10 Nov 28 '16 at 17:37
  • Well, the URL you provided throws a HTTP 400 error for me while the Socrata API provided 84,672 pristine records in a data frame. Hopefully someone else can help you. – hrbrmstr Nov 28 '16 at 17:39
  • hmmm interesting quite a conundrum! Hopefully yeah, thanks for the suggestions though! – LoF10 Nov 28 '16 at 17:41

0 Answers0