-
Notifications
You must be signed in to change notification settings - Fork 83
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
Fixes #19 JSON download error #102
Conversation
…deal with missing columns in JSON files. Changes JSON download tests because now JSON files download logical data as a logical data type, instead of character.
Haven't done a full code review yet, but a few things. The unit testing failed. Looks like the Also, be sure to sign the Contributor License Agreement. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good. I didn't understand the need to include "logical" on the expect_equal
.
@@ -125,7 +125,7 @@ test_that("read Socrata JSON as default", { | |||
expect_equal(1007, nrow(df), label="rows") | |||
expect_equal(11, ncol(df), label="columns") | |||
expect_equal(c("character", "character", "character", "character", "character", | |||
"character", "character", "character", "character", "character", | |||
"character", "logical", "character", "character", "character", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the "logical" return now needed? Is it for the needs_recoding
field?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is for needs_recoding
. It had been coming in as a "character" but with this code change it started coming in as a "logical". I think using fromJSON()
is what caused this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, but we'll have to be very careful to note this since this could mess-up someone's existing code. That is, someone downloading from Socrata may have code that works because that field is downloaded as chr
, but may not because it's logical
.
I think this closes #19. It uses fromJSON to parse the download and then uses rbind.fill from plyr to deal with the NAs and missing columns in the JSON files.