Thanks! The crimer package is super useful, it provides a wrapper for agency level queries, but I want to look at all agencies & there are 18,575..... can you help me write a loop that would basically query each agency?
so if this is the call for agency ""NY330SS00"
get_agency_crime("NY330SS00", since = 2010, until = 2017)
I want to go through a list called "agencies", and replace "NY330SS00" with the name of each agency and then bind all results together to create one df.
so for example if
> agency_vec <- c("1", "2", "3"))
then a loop or function that will basically execute
a <- get_agency_crime("1", since = 2010, until = 2017)
b <- get_agency_crime("2", since = 2010, until = 2017)
c <- get_agency_crime("3", since = 2010, until = 2017)
rbind(a,b,c)
here is what I tried:
for (i in agency_vec){
get_agency_crime(i, since = 2017, until = 2017)
} -> test.results
but the problem with the loop is that it only saves the last api call, not all of them
so view(test.results) would only show the results for the last agency in agency_vec
how can I save & bind the results from each call without doing it manually??
any suggestions or ideas so appreciated thank you!!!