Chicago / RSocrata

Provides easier interaction with Socrata open data portals http://dev.socrata.com. Users can provide a 'Socrata' data set resource URL, or a 'Socrata' Open Data API (SoDA) web query, or a 'Socrata' "human-friendly" URL, returns an R data frame. Converts dates to 'POSIX' format. Manages throttling by 'Socrata'.
https://CRAN.R-project.org/package=RSocrata
Other
236 stars 83 forks source link

Error in read.socrata #191

Closed ecorreig closed 4 years ago

ecorreig commented 4 years ago

I'm trying to download data from this link:

"https://dev.socrata.com/foundry/analisi.transparenciacatalunya.cat/jj6z-iyrp" by doing:

df <- RSocrata::read.socrata("https://dev.socrata.com/foundry/analisi.transparenciacatalunya.cat/jj6z-iyrp", stringsAsFactors = F)

But I get the following error:

Error in while (nrow(page) > 0 & !limitProvided) { : 
  argument is of length zero

The data is correct because in python, with sodapy, I can access without issue, so I don't know what might be hapenning...

Thanks, Eudald

nicklucius commented 4 years ago

Hi @ecorreig, thanks for the report. I think the issue is that the URL is not an actual dataset URL, which read.socrata() is expecting, but instead is a Socrata documentation page. I noticed the documentation does contain a API link which is compatible with read.socrata(). Could you try:

df <- RSocrata::read.socrata("https://analisi.transparenciacatalunya.cat/resource/jj6z-iyrp.json", stringsAsFactors = F)
ecorreig commented 4 years ago

Wow,I thought I had tried this before writing... Thanks a lot!

Regardless, maybe a specific error message for dumb people like me?

nicklucius commented 4 years ago

No worries!