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

chain entry in redist_plans gets overwritten in rbind() #184

Open
christopherkenny opened this issue Mar 20, 2024 · 0 comments
Open

chain entry in redist_plans gets overwritten in rbind() #184

christopherkenny opened this issue Mar 20, 2024 · 0 comments
Assignees
Labels

Comments

@christopherkenny
Copy link
Member

Reprex as requested @CoryMcCartan

devtools::load_all()
#> ℹ Loading redist
#> Loading required package: redistmetrics

data(iowa)
ia <- redist_map(iowa, existing_plan = cd_2010, pop_tol = 0.01)
plans_1 <- redist_smc(ia, 100, runs = 2)
plans_2 <- redist_smc(ia, 100, runs = 2)

rbind(plans_1, plans_2) |> 
    dplyr::count(chain)
#>   chain   n
#> 1     1 804
#> 2     2 804

Created on 2024-03-20 with reprex v2.0.2

Instead, this should look something like NA, 1, 2, NA, 3, 4 but it comes out as 1, 2 because of this line:

ret <- bind_rows(lapply(objs, dplyr::as_tibble), .id = "chain")

christopherkenny added a commit that referenced this issue Mar 30, 2024
@CoryMcCartan CoryMcCartan self-assigned this Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants