Skip to content

Commit

Permalink
go back to using scales from analyses pipeline
Browse files Browse the repository at this point in the history
and use withr$with_package("dplyr",...) to get around box issue.
  • Loading branch information
RWParsons committed Jun 5, 2024
1 parent 42a2edd commit 989275f
Show file tree
Hide file tree
Showing 12 changed files with 388 additions and 558 deletions.
2 changes: 1 addition & 1 deletion R/create-map-polygon.R
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ get_popup_glue <- function(asgs, care_type) {


seifa_scale_to_text <- function(x) {
dplyr::case_when(
case_when(
x == 1 ~ "Most disadvantaged",
x == 2 ~ "Disadvantaged",
x == 3 ~ "Middle socio-economic status",
Expand Down
6 changes: 3 additions & 3 deletions R/save-app-scales.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ save_app_scale_fxs <- function(itraqi_list) {


seifa_text_to_value <- function(x) {
dplyr::case_when(
case_when(
x == "Most disadvantaged" ~ 1,
x == "Disadvantaged" ~ 2,
x == "Middle socio-economic status" ~ 3,
Expand All @@ -22,7 +22,7 @@ seifa_text_to_value <- function(x) {
}

ra_scale_to_text <- function(x) {
dplyr::case_when(
case_when(
x == 0 ~ "Major Cities of Australia",
x == 1 ~ "Inner Regional Australia",
x == 2 ~ "Outer Regional Australia",
Expand All @@ -33,7 +33,7 @@ ra_scale_to_text <- function(x) {
}

ra_text_to_value <- function(x) {
dplyr::case_when(
case_when(
x == "Major Cities of Australia" ~ 0,
x == "Inner Regional Australia" ~ 1,
x == "Outer Regional Australia" ~ 2,
Expand Down
5 changes: 5 additions & 0 deletions _targets.R
Original file line number Diff line number Diff line change
Expand Up @@ -524,5 +524,10 @@ list(
app_palette,
save_app_palette(itraqi_list),
format = "file"
),
tar_target(
app_scale_fxs,
save_app_scale_fxs(itraqi_list),
format = "file"
)
)
12 changes: 6 additions & 6 deletions _targets/meta/meta
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ app_palette|stem|cac570aeb87fb676|e24316a13bb70c3f|4344e541fc69628d|1089662940|C
app_polygons|stem|e7d123b9aec4e861|5c835e7fc326dfb4|fac77f55835876ba|292954876|C:/Users/n10891277/R_projects/iTRAQI-analyses/output/stacked_SA1_and_SA2_polygons.rds|t19875.4977091281s|f5319271863f1aa5|1670214|file|local|vector|||30.531|repeating attributes for all subgeometries for which they may not be constant. repeating attributes for all subgeometries for which they may not be constant. repeating attributes for all subgeometries for which they may not be constant. repeating attributes for all subgeometries for which they may not be constant. repeating attributes for all subgeometries for which they may not be constant. repeating attributes for all subgeometries for which they may not be constant|
app_raster|stem|c2cbf9546e160981|b13b86c57469fee5|b8786adeabdd75a5|-1751902619|C:/Users/n10891277/R_projects/iTRAQI-analyses/output/raster_points.rds|t19806.2605021909s||6312158|file|local|vector|||1.594||promise already under evaluation recursive default argument reference or earlier problems
app_rasters|stem|c31f84f47f2831bd|b13b86c57469fee5|6e278b5c140235a8|1306936721||t0s|f4066a65ff755f48|0|file|local|vector|||2.203||
app_scale_fxs|stem|c78b801dabb917c5|514b0a88839ebf2b|589a8b9a1196e788|-280546199|C:/Users/n10891277/R_projects/iTRAQI-analyses/output/scale_fxs.rds|t19879.0405234028s|502baa2af2ed0ba7|25261|file|local|vector|||1.563||
app_scale_fxs|stem|20fe6b94c43f2e83|514b0a88839ebf2b|d097146eda55c46a|-280546199|C:/Users/n10891277/R_projects/iTRAQI-analyses/output/scale_fxs.rds|t19879.1712086769s|c2212432560d6336|25123|file|local|vector|||1.75||
breaks_to_labels|function|15aa190f0fc9cc8c|||||||||||||||
cell_size_agg|object|e9200b1fe25d1e1c|||||||||||||||
CELL_SIZE_METERS|object|42b194eec038fae9|||||||||||||||
Expand Down Expand Up @@ -142,8 +142,8 @@ qas_locations_file|stem|47d8b576de70ef8e|fd3582224bc61473|ef46db3751d8e999|71835
qas_map|stem|e69241543175c797|eea5e9f0030edc9d|55f10a27542bd307|61823707||t19875.4978105361s|6aac70ce59868a33|131|rds|local|vector|||0.407||
qld_locations_file|stem|371950c86cc87bec|1ec6722829c44405|ef46db3751d8e999|1094260305|data/QLDLocations3422.csv|t19409.0793635134s|8e55589b30e156b7|15655|file|local|vector|||0.704||
quintile_from_decile|function|bc270d6e6e422eb2|||||||||||||||
ra_scale_to_text|function|c43f6624f5e459a7|||||||||||||||
ra_text_to_value|function|dd6b49691d4852aa|||||||||||||||
ra_scale_to_text|function|c1acc9ff04332e8b|||||||||||||||
ra_text_to_value|function|73d5d9d86704dc76|||||||||||||||
read_acute_pathways|function|1a36ca8a0230d230|||||||||||||||
read_rehab_data|function|a09cb307a4d6a798|||||||||||||||
remoteness_files|pattern|98c703641e4cde89|d364f7500701dda5||-796710876||||6302502|file|local|vector||remoteness_files_82c12366*remoteness_files_2bb95249*remoteness_files_a8528819*remoteness_files_06e81f91|0||
Expand All @@ -156,15 +156,15 @@ rename_travel_time_df|function|82572c667aa9ceb3|||||||||||||||
rsq_locations_file|stem|72685425b2fb4cb6|7c2c0922575a2b28|ef46db3751d8e999|-3892719|data/inputs-for-visualisations/rsq_locations.csv|t19221.9976706623s|17fd65357607abf9|576|file|local|vector|||1.297||
rsq_maps|stem|640a4e2523c1fca4|765ca2014d1ef285|7cf20ddf76bed36f|1296509518||t19875.497779303s|c303d0aa7a9c897f|156|rds|local|vector|||0.703||
save_app_palette|function|3e75f24dac6a9f85|||||||||||||||
save_app_scale_fxs|function|2a9b1b250e0153c4|||||||||||||||
save_app_scale_fxs|function|2229d381d8768cb5|||||||||||||||
seifa_files|pattern|5cfc04b4c3634603|887c54425a6ada27||-1920692518||||112005632|file|local|vector||seifa_files_0fd258b0*seifa_files_3df8e749*seifa_files_b0acac7a*seifa_files_cab70577|0.016||
seifa_files_0fd258b0|branch|ca67916bf2742b10|887c54425a6ada27|ef46db3751d8e999|927023566|data/remoteness_and_seifa_data/2011_sa1_seifa.xls|t19409.0793720087s|c62dc507448a4207|53460992|file|local|vector|seifa_files||0||
seifa_files_3df8e749|branch|fbea7dee06d6d9d0|887c54425a6ada27|ef46db3751d8e999|56803531|data/remoteness_and_seifa_data/2011_sa2_seifa.xls|t19409.0793722171s|7c6c151c2bab7198|2412544|file|local|vector|seifa_files||0.016||
seifa_files_b0acac7a|branch|b5e556e507134893|887c54425a6ada27|ef46db3751d8e999|309424726|data/remoteness_and_seifa_data/2016_sa1_seifa.xls|t19409.07937518s|c28695aedb990632|54134784|file|local|vector|seifa_files||0||
seifa_files_cab70577|branch|41a0e4b1c1180c59|887c54425a6ada27|ef46db3751d8e999|-973884529|data/remoteness_and_seifa_data/2016_sa2_seifa.xls|t19409.0793753539s|a7fed4e7b47695f0|1997312|file|local|vector|seifa_files||0||
seifa_files_files|stem|92a6bd0e048be9f5|a03078bd0f3ea3f6|ef46db3751d8e999|1567115929||t19736.7001155751s|bf0d8caacacad815|112|rds|local|list||seifa_files_files_b8e0c22c*seifa_files_files_e491d188*seifa_files_files_62b7ff49*seifa_files_files_146326d6|0||
seifa_scale_to_text|function|5d72251148e5bae2|||||||||||||||
seifa_text_to_value|function|6d61674a937af476|||||||||||||||
seifa_scale_to_text|function|9654adcfacd5dc4b|||||||||||||||
seifa_text_to_value|function|1b54a5c209cba897|||||||||||||||
silver_locs|object|fc5aaa3d2a561f0c|||||||||||||||
tbl_to_raster|function|bf64572f21350623|||||||||||||||
template_files|stem|751da96a4f79949e|b6c543b3df6e354c|ef46db3751d8e999|-678564935||t19784.2317935203s|f3963c450082b208|143|rds|local|vector|||0.969||
Expand Down
Binary file added app/app/data/scale_fxs.rds
Binary file not shown.
52 changes: 10 additions & 42 deletions app/app/logic/scales_and_palettes.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
box::use(
dplyr,
withr,
)

box::use(
Expand All @@ -8,64 +9,31 @@ box::use(

palette_list <- readRDS(file.path(constants$data_dir, "palette_list.rds"))

#' @export
seifa_scale_to_text <- function(x) {
dplyr$case_when(
x == 1 ~ "Most disadvantaged",
x == 2 ~ "Disadvantaged",
x == 3 ~ "Middle socio-economic status",
x == 4 ~ "Advantaged",
x == 5 ~ "Most advantaged",
.default = "NA"
)
}
scale_fxs <- readRDS(file.path(constants$data_dir, "scale_fxs.rds"))

#' @export
seifa_text_to_value <- function(x) {
dplyr$case_when(
x == "Most disadvantaged" ~ 1,
x == "Disadvantaged" ~ 2,
x == "Middle socio-economic status" ~ 3,
x == "Advantaged" ~ 4,
x == "Most advantaged" ~ 5,
)
}
seifa_scale_to_text <- function(x) withr$with_package("dplyr", scale_fxs$seifa_scale_to_text(x))

#' @export
ra_scale_to_text <- function(x) {
dplyr$case_when(
x == 0 ~ "Major Cities of Australia",
x == 1 ~ "Inner Regional Australia",
x == 2 ~ "Outer Regional Australia",
x == 3 ~ "Remote Australia",
x == 4 ~ "Very Remote Australia",
TRUE ~ "NA"
)
}
seifa_text_to_value <- function(x) withr$with_package("dplyr", scale_fxs$seifa_text_to_value(x))

#' @export
ra_text_to_value <- function(x) {
dplyr$case_when(
x == "Major Cities of Australia" ~ 0,
x == "Inner Regional Australia" ~ 1,
x == "Outer Regional Australia" ~ 2,
x == "Remote Australia" ~ 3,
x == "Very Remote Australia" ~ 4,
)
}
seifa_text_choices <- c(seifa_scale_to_text(1:5), "NA")

#' @export
ra_scale_to_text <- function(x) withr$with_package("dplyr", scale_fxs$ra_scale_to_text(x))

#' @export
seifa_text_choices <- c(seifa_scale_to_text(1:5), "NA")
ra_text_to_value <- function(x) withr$with_package("dplyr", scale_fxs$ra_text_to_value(x))

#' @export
ra_text_choices <- ra_scale_to_text(0:4)

#' @export
pal_mins <- palette_list$palNum
pal_mins <- function(x) withr$with_package("dplyr", palette_list$palNum(x))

#' @export
pal_hours <- palette_list$palNum_hours
pal_hours <- function(x) withr$with_package("dplyr", palette_list$palNum_hours(x))

#' @export
pal_index <- palette_list$paliTRAQI
Expand Down
3 changes: 2 additions & 1 deletion app/app/mapping/update_map_content.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
box::use(
dplyr,
leaflet,
leafgl,
dplyr,
withr,
)


Expand Down
1 change: 1 addition & 0 deletions app/app/view/main_map/page.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ box::use(
shiny,
bslib,
leaflet,
strayr,
sf,
leafgl,
dplyr,
Expand Down
113 changes: 0 additions & 113 deletions app/renv.lock
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,6 @@
],
"Hash": "b765b28387acc8ec9e9c1530713cb19c"
},
"PKI": {
"Package": "PKI",
"Version": "0.1-12",
"Source": "Repository",
"Repository": "RSPM",
"Requirements": [
"R",
"base64enc"
],
"Hash": "999d7960fe5a5fd98267d0b68fd10065"
},
"R.cache": {
"Package": "R.cache",
"Version": "0.16.0",
Expand Down Expand Up @@ -161,16 +150,6 @@
],
"Hash": "74a64813f17b492da9c6afda6b128e3d"
},
"askpass": {
"Package": "askpass",
"Version": "1.2.0",
"Source": "Repository",
"Repository": "RSPM",
"Requirements": [
"sys"
],
"Hash": "cad6cf7f1d5f6e906700b9d3e718c796"
},
"backports": {
"Package": "backports",
"Version": "1.4.1",
Expand Down Expand Up @@ -363,16 +342,6 @@
],
"Hash": "ab12c7b080a57475248a30f4db6298c0"
},
"curl": {
"Package": "curl",
"Version": "5.2.1",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R"
],
"Hash": "411ca2c03b1ce5f548345d2fc2685f7a"
},
"cyclocomp": {
"Package": "cyclocomp",
"Version": "1.1.1",
Expand Down Expand Up @@ -883,28 +852,6 @@
],
"Hash": "4fd8900853b746af55b81fda99da7695"
},
"openssl": {
"Package": "openssl",
"Version": "2.2.0",
"Source": "Repository",
"Repository": "RSPM",
"Requirements": [
"askpass"
],
"Hash": "2bcca3848e4734eb3b16103bc9aa4b8e"
},
"packrat": {
"Package": "packrat",
"Version": "0.9.2",
"Source": "Repository",
"Repository": "RSPM",
"Requirements": [
"R",
"tools",
"utils"
],
"Hash": "55ddd2d4a1959535f18393478b0c14a6"
},
"pillar": {
"Package": "pillar",
"Version": "1.9.0",
Expand Down Expand Up @@ -1198,29 +1145,6 @@
],
"Hash": "4c8415e0ec1e29f3f4f6fc108bef0144"
},
"rsconnect": {
"Package": "rsconnect",
"Version": "1.3.0",
"Source": "Repository",
"Repository": "RSPM",
"Requirements": [
"PKI",
"R",
"cli",
"curl",
"digest",
"jsonlite",
"lifecycle",
"openssl",
"packrat",
"renv",
"rlang",
"rstudioapi",
"tools",
"yaml"
],
"Hash": "8bc31f130662910340c98602ab92fddd"
},
"rstudioapi": {
"Package": "rstudioapi",
"Version": "0.14",
Expand Down Expand Up @@ -1388,36 +1312,6 @@
],
"Hash": "75940133cca2e339afce15a586f85b11"
},
"stringi": {
"Package": "stringi",
"Version": "1.8.4",
"Source": "Repository",
"Repository": "RSPM",
"Requirements": [
"R",
"stats",
"tools",
"utils"
],
"Hash": "39e1144fd75428983dc3f63aa53dfa91"
},
"stringr": {
"Package": "stringr",
"Version": "1.5.1",
"Source": "Repository",
"Repository": "RSPM",
"Requirements": [
"R",
"cli",
"glue",
"lifecycle",
"magrittr",
"rlang",
"stringi",
"vctrs"
],
"Hash": "960e2ae9e09656611e0b8214ad543207"
},
"styler": {
"Package": "styler",
"Version": "1.9.1",
Expand All @@ -1437,13 +1331,6 @@
],
"Hash": "ed8c90822b7da46beee603f263a85fe0"
},
"sys": {
"Package": "sys",
"Version": "3.4.2",
"Source": "Repository",
"Repository": "RSPM",
"Hash": "3a1be13d68d47a8cd0bfd74739ca1555"
},
"terra": {
"Package": "terra",
"Version": "1.7-78",
Expand Down
Loading

0 comments on commit 989275f

Please sign in to comment.