Skip to content
Snippets Groups Projects
Commit fa8146fa authored by Azadpour, Elmera's avatar Azadpour, Elmera
Browse files

edit processing to use SB data csv

parent 0ce311d0
No related branches found
No related tags found
1 merge request!12Add disaggregated census data/maps
......@@ -3,14 +3,15 @@ source('2_process/src/data_utils.R')
p2_targets <- list(
# Confirming raw data matches `p1_unc_stats` from SB
tar_target(p2_unc_agg_summary,
p1_unc_agg |>
p1_unc_stats |>
group_by(dimension, determinant) |>
summarize(across(c(contains('related'),
contains('unknown'),
contains('significant')),
contains('significant'),
contains('direction')),
list(total = ~sum(.x, na.rm=TRUE)))) |>
mutate(evidence_val = positively_related_total + negatively_related_total +
unrelated_total + unknown_direction_total)
mutate(evidence_val = pos_related_total + neg_related_total +
unrelated_total + unk_direction_total)
),
# Based on metadata:
# Amt of evidence: Small = total_studies < 5; Medium = total_studies 5-9; Large,total_studies = > 9
......@@ -18,22 +19,22 @@ p2_targets <- list(
tar_target(p2_top_trend_stats,
p2_unc_agg_summary |>
dplyr::select(dimension, determinant, #indicator,
positively_related_total, negatively_related_total, unrelated_total,
unknown_direction_total) |>
pos_related_total, neg_related_total, unrelated_total,
unk_direction_total) |>
pivot_longer(!c(dimension,determinant)) |>
group_by(dimension, determinant) |>
# for each indicator find the maximum % of studies in agreement
# for each determinant find the maximum % of studies in agreement
# across the significance categories.
slice_max(value) |>
rename(sig_name = name, sig_value = value)
),
# Join `p2_unc_agg_summary` to top trends to get percentages of agreement and evidence
tar_target(p2_unc_agg_summary_csv,
tar_target(`p2_unc_agg_summary_csv`,
p2_unc_agg_summary |>
left_join(p2_top_trend_stats) |>
# level of agreement is the max percent of studies in agreement
dplyr::mutate(level_agreement = 100*(sig_value/evidence_val)) |>
readr::write_csv('2_process/out/indicator_uncertainty.csv')
readr::write_csv('2_process/out/determinant_uncertainty.csv')
),
tar_target(p2_indicators,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment