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

aw_interpolate fails when tid and sid are the same #7

Closed
chris-prener opened this issue Dec 21, 2018 · 2 comments
Closed

aw_interpolate fails when tid and sid are the same #7

chris-prener opened this issue Dec 21, 2018 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@chris-prener
Copy link
Owner

See Issue #6 for a reprex - since @mfherman is using two census geometries, the ID is GEOID in both cases and we get this for output:

> aw_interpolate(
+   si_zcta,
+   tid = GEOID,
+   source = si_tract,
+   sid = GEOID,
+   weight = "sum",
+   output = "tibble",
+   extensive = "popE"
+ )
# A tibble: 13 x 2
   GEOID  popE
 * <chr> <dbl>
 1 10301    NA
 2 10302    NA
 3 10303    NA
 4 10304    NA
 5 10305    NA
 6 10306    NA
 7 10307    NA
 8 10308    NA
 9 10309    NA
10 10310    NA
11 10311    NA
12 10312    NA
13 10314    NA

Renaming one of the ID variables from GEOID to anything else fixes it. Not sure how to handle this yet. For now, @mfherman, rename your target ID variable until we address this.

@chris-prener chris-prener added the bug Something isn't working label Dec 21, 2018
@chris-prener chris-prener self-assigned this Dec 21, 2018
@chris-prener
Copy link
Owner Author

The fix for this looked like so:

> si_zcta2 <- rename(si_zcta, id = GEOID)
> aw_interpolate(
+   si_zcta2,
+   tid = id,
+   source = si_tract,
+   sid = GEOID,
+   weight = "sum",
+   output = "tibble",
+   extensive = "popE"
+ )
# A tibble: 13 x 2
   id      popE
 * <chr>  <dbl>
 1 10301 41705.
 2 10302 16504.
 3 10303 25834.
 4 10304 41365.
 5 10305 44373.
 6 10306 53132.
 7 10307 12564.
 8 10308 27879.
 9 10309 31901.
10 10310 22839.
11 10311   464.
12 10312 66662.
13 10314 88100.

@chris-prener
Copy link
Owner Author

The multipolygon branch now contains a fix for this issue as well. It also includes a unit test that confirms the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant