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

match_numbers() returns ordered factor rather than integer #150

Closed
christopherkenny opened this issue Jul 26, 2022 · 1 comment
Closed
Milestone

Comments

@christopherkenny
Copy link
Member

This breaks left_join, rbind, add_reference to name a few.

library(redist)
#> Warning: package 'redist' was built under R version 4.2.1
#> Loading required package: redistmetrics
#> 
#> Attaching package: 'redist'
#> The following object is masked from 'package:stats':
#> 
#>     filter
data(iowa)
ia <- redist_map(iowa, existing_plan = cd_2010, pop_tol = 0.01)
pl <- redist_smc(ia, nsims = 100)
#> SEQUENTIAL MONTE CARLO
#> Sampling 100 99-unit maps with 4 districts and population between 753973 and 769205.
#> Split [0/3] ■ | ETA?
#> Split [3/3] ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■  | ETA 0s
pl <- match_numbers(pl, ia$cd_2010)
class(pl$district)
#> [1] "ordered" "factor"

Created on 2022-07-25 by the reprex package (v2.0.1)

@CoryMcCartan
Copy link
Member

Preferred approach to resolve: add handlers to add_reference & rbind.redist_plans. Use of left_join() is extremely rare outside 50-states (and even there we can / should just use bind_cols())

@christopherkenny christopherkenny added this to the 4.1 milestone Jan 4, 2023
@christopherkenny christopherkenny modified the milestones: 4.1, 4.2 Mar 18, 2023
@CoryMcCartan CoryMcCartan modified the milestones: 4.2, 4.1 Mar 20, 2023
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