Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Receiving an empty dataframe #190

Closed
will-champ opened this issue Aug 17, 2020 · 3 comments
Closed

Receiving an empty dataframe #190

will-champ opened this issue Aug 17, 2020 · 3 comments
Assignees

Comments

@will-champ
Copy link

Hello! I am trying to pull data from NY State regarding vehicle registration (see here) filtering for New York City, which appears as NEW YORK in the table. Code is as follows:

mydata <- RSocrata::read.socrata("https://data.ny.gov/resource/w4pv-hbkt.json?$where=city='NEW YORK'")

Every time I enter it, the code executes but I receive a dataframe with 0 observations. Any ideas of why this may be?

@tomschenkjr
Copy link
Contributor

@willchampbrown - I attempted to replicate the query https://data.ny.gov/resource/w4pv-hbkt.json?$where=city='NEW YORK' in the browser, but returned an empty frame. It seems like the query itself doesn't return results so nothing is being returned to RSocrata.

@tomschenkjr
Copy link
Contributor

tomschenkjr commented Aug 18, 2020

@willchampbrown - I took a look at the query, which seems fine. I then tried to perform a similar filter on the data in the browser, but it seems like "NEW YORK" is not a valid string. I looked at the entire JSON and appears there are tons of spaces in a given response.

Here is an entry for one in New York:

{"record_type":"VEH ",
"vin":"9309800080       ",
"registration_class":"PAS",
"city":"NEW YORK       ",
"state":"NY",
"zip":"10017",
"county":"NEW YORK    ",
"model_year":"1979",
"make":"PORSC",
"body_type":"2DSD",
"fuel_type":"GAS     ",
"unladen_weight":"2855",
"reg_valid_date":"2018-08-01T00:00:00.000",
"reg_expiration_date":"2020-09-02T00:00:00.000",
"color":"BL   ",
"scofflaw_indicator":"N",
"suspension_indicator":"N",
"revocation_indicator":"N"}

So, I just think the query needs to reflect the spaces. Also note, sometimes NYC is specified as "New York" and other times as "New York City".

@will-champ
Copy link
Author

entire JSON

Thank you so much – you are absolutely right, I was just copying the value from the table. I will be looking at the json moving forward to validate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants