Skip to content

Commit

Permalink
Diagnose reason of weird result (inner not left join), close #34
Browse files Browse the repository at this point in the history
  • Loading branch information
Robinlovelace committed Aug 2, 2024
1 parent b2f259e commit 9b49283
Show file tree
Hide file tree
Showing 3 changed files with 444 additions and 182 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
.Ruserdata
*.gpkg
*.pdf
*.html
paper/paper_files/
20 changes: 17 additions & 3 deletions R/si_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,30 @@ constrain_production = function(od, output_col, constraint_production) {
"{output_col}" := .data[[output_col]] /
sum(.data[[output_col]]) * dplyr::first( {{constraint_production}} )
)
# browser()
# # Assert values are correct for test data:
# od_grouped |>
# select(origin_all, interaction)
# od_grouped |>
# select({{constraint_production}}, interaction)
# origin_totals = od_grouped |>
# sf::st_drop_geometry() |>
# sf::st_drop_geometry() |>
# # group_by(1) |>
# summarise(
# sum = sum(interaction),
# first = first(origin_all)
# first = first({{constraint_production}})
# )
# cor(origin_totals$sum, origin_totals$first)
# # Test for york data:
# zone_totals = left_join(
# zones_york |>
# sf::st_drop_geometry() |>
# rename(O = LSOA21CD) |>
# select(O, pupils_estimated),
# origin_totals
# )



od = dplyr::ungroup(od_grouped)
od
}
Expand Down
Loading

0 comments on commit 9b49283

Please sign in to comment.