Long data frame mapping area hierarchy areas to model level areas

create_area_aggregation(model_area_ids, areas, drop_partial_areas = TRUE)

Arguments

model_area_ids

vector of model areas.

areas

naomi_areas object.

drop_partial_areas

Drop areas from output if some children are missing (default TRUE).

Examples


area_merged <- read_area_merged(system.file("extdata/demo_areas.geojson", package = "naomi"))
areas <- create_areas(area_merged = area_merged)
model_area_ids <- area_merged$area_id[area_merged$area_level == 4]

create_area_aggregation(model_area_ids, areas)
#>                           area_id model_area_id
#> MWI_4_1_demo...1              MWI  MWI_4_1_demo
#> MWI_4_2_demo...2              MWI  MWI_4_2_demo
#> MWI_4_3_demo...3              MWI  MWI_4_3_demo
#> MWI_4_4_demo...4              MWI  MWI_4_4_demo
#> MWI_4_6_demo...5              MWI  MWI_4_6_demo
#> MWI_4_5_demo...6              MWI  MWI_4_5_demo
#> MWI_4_7_demo...7              MWI  MWI_4_7_demo
#> MWI_4_8_demo...8              MWI  MWI_4_8_demo
#> MWI_4_9_demo...9              MWI  MWI_4_9_demo
#> MWI_4_10_demo...10            MWI MWI_4_10_demo
#> MWI_4_11_demo...11            MWI MWI_4_11_demo
#> MWI_4_12_demo...12            MWI MWI_4_12_demo
#> MWI_4_13_demo...13            MWI MWI_4_13_demo
#> MWI_4_14_demo...14            MWI MWI_4_14_demo
#> MWI_4_15_demo...15            MWI MWI_4_15_demo
#> MWI_4_16_demo...16            MWI MWI_4_16_demo
#> MWI_4_17_demo...17            MWI MWI_4_17_demo
#> MWI_4_18_demo...18            MWI MWI_4_18_demo
#> MWI_4_19_demo...19            MWI MWI_4_19_demo
#> MWI_4_20_demo...20            MWI MWI_4_20_demo
#> MWI_4_21_demo...21            MWI MWI_4_21_demo
#> MWI_4_22_demo...22            MWI MWI_4_22_demo
#> MWI_4_23_demo...23            MWI MWI_4_23_demo
#> MWI_4_24_demo...24            MWI MWI_4_24_demo
#> MWI_4_25_demo...25            MWI MWI_4_25_demo
#> MWI_4_26_demo...26            MWI MWI_4_26_demo
#> MWI_4_29_demo...27            MWI MWI_4_29_demo
#> MWI_4_27_demo...28            MWI MWI_4_27_demo
#> MWI_4_28_demo...29            MWI MWI_4_28_demo
#> MWI_4_30_demo...30            MWI MWI_4_30_demo
#> MWI_4_31_demo...31            MWI MWI_4_31_demo
#> MWI_4_32_demo...32            MWI MWI_4_32_demo
#> MWI_4_1_demo...33    MWI_1_1_demo  MWI_4_1_demo
#> MWI_4_2_demo...34    MWI_1_1_demo  MWI_4_2_demo
#> MWI_4_3_demo...35    MWI_1_1_demo  MWI_4_3_demo
#> MWI_4_4_demo...36    MWI_1_1_demo  MWI_4_4_demo
#> MWI_4_6_demo...37    MWI_1_1_demo  MWI_4_6_demo
#> MWI_4_5_demo...38    MWI_1_1_demo  MWI_4_5_demo
#> MWI_4_7_demo...39    MWI_1_1_demo  MWI_4_7_demo
#> MWI_4_8_demo...40    MWI_1_2_demo  MWI_4_8_demo
#> MWI_4_9_demo...41    MWI_1_2_demo  MWI_4_9_demo
#> MWI_4_10_demo...42   MWI_1_2_demo MWI_4_10_demo
#> MWI_4_11_demo...43   MWI_1_2_demo MWI_4_11_demo
#> MWI_4_12_demo...44   MWI_1_2_demo MWI_4_12_demo
#> MWI_4_13_demo...45   MWI_1_2_demo MWI_4_13_demo
#> MWI_4_14_demo...46   MWI_1_2_demo MWI_4_14_demo
#> MWI_4_15_demo...47   MWI_1_2_demo MWI_4_15_demo
#> MWI_4_16_demo...48   MWI_1_2_demo MWI_4_16_demo
#> MWI_4_17_demo...49   MWI_1_2_demo MWI_4_17_demo
#> MWI_4_18_demo...50   MWI_1_3_demo MWI_4_18_demo
#> MWI_4_19_demo...51   MWI_1_3_demo MWI_4_19_demo
#> MWI_4_20_demo...52   MWI_1_3_demo MWI_4_20_demo
#> MWI_4_21_demo...53   MWI_1_3_demo MWI_4_21_demo
#> MWI_4_22_demo...54   MWI_1_3_demo MWI_4_22_demo
#> MWI_4_23_demo...55   MWI_1_3_demo MWI_4_23_demo
#> MWI_4_24_demo...56   MWI_1_3_demo MWI_4_24_demo
#> MWI_4_25_demo...57   MWI_1_3_demo MWI_4_25_demo
#> MWI_4_26_demo...58   MWI_1_3_demo MWI_4_26_demo
#> MWI_4_29_demo...59   MWI_1_3_demo MWI_4_29_demo
#> MWI_4_27_demo...60   MWI_1_3_demo MWI_4_27_demo
#> MWI_4_28_demo...61   MWI_1_3_demo MWI_4_28_demo
#> MWI_4_30_demo...62   MWI_1_3_demo MWI_4_30_demo
#> MWI_4_31_demo...63   MWI_1_3_demo MWI_4_31_demo
#> MWI_4_32_demo...64   MWI_1_3_demo MWI_4_32_demo
#> MWI_4_1_demo...65    MWI_2_1_demo  MWI_4_1_demo
#> MWI_4_2_demo...66    MWI_2_1_demo  MWI_4_2_demo
#> MWI_4_3_demo...67    MWI_2_1_demo  MWI_4_3_demo
#> MWI_4_4_demo...68    MWI_2_1_demo  MWI_4_4_demo
#> MWI_4_6_demo...69    MWI_2_1_demo  MWI_4_6_demo
#> MWI_4_5_demo...70    MWI_2_1_demo  MWI_4_5_demo
#> MWI_4_7_demo...71    MWI_2_1_demo  MWI_4_7_demo
#> MWI_4_8_demo...72    MWI_2_2_demo  MWI_4_8_demo
#> MWI_4_9_demo...73    MWI_2_2_demo  MWI_4_9_demo
#> MWI_4_10_demo...74   MWI_2_2_demo MWI_4_10_demo
#> MWI_4_11_demo...75   MWI_2_2_demo MWI_4_11_demo
#> MWI_4_12_demo...76   MWI_2_2_demo MWI_4_12_demo
#> MWI_4_13_demo...77   MWI_2_3_demo MWI_4_13_demo
#> MWI_4_14_demo...78   MWI_2_3_demo MWI_4_14_demo
#> MWI_4_15_demo...79   MWI_2_3_demo MWI_4_15_demo
#> MWI_4_16_demo...80   MWI_2_3_demo MWI_4_16_demo
#> MWI_4_17_demo...81   MWI_2_3_demo MWI_4_17_demo
#> MWI_4_18_demo...82   MWI_2_4_demo MWI_4_18_demo
#> MWI_4_19_demo...83   MWI_2_4_demo MWI_4_19_demo
#> MWI_4_20_demo...84   MWI_2_4_demo MWI_4_20_demo
#> MWI_4_21_demo...85   MWI_2_4_demo MWI_4_21_demo
#> MWI_4_22_demo...86   MWI_2_4_demo MWI_4_22_demo
#> MWI_4_23_demo...87   MWI_2_4_demo MWI_4_23_demo
#> MWI_4_24_demo...88   MWI_2_4_demo MWI_4_24_demo
#> MWI_4_25_demo...89   MWI_2_5_demo MWI_4_25_demo
#> MWI_4_26_demo...90   MWI_2_5_demo MWI_4_26_demo
#> MWI_4_29_demo...91   MWI_2_5_demo MWI_4_29_demo
#> MWI_4_27_demo...92   MWI_2_5_demo MWI_4_27_demo
#> MWI_4_28_demo...93   MWI_2_5_demo MWI_4_28_demo
#> MWI_4_30_demo...94   MWI_2_5_demo MWI_4_30_demo
#> MWI_4_31_demo...95   MWI_2_5_demo MWI_4_31_demo
#> MWI_4_32_demo...96   MWI_2_5_demo MWI_4_32_demo
#> MWI_4_1_demo...97    MWI_3_1_demo  MWI_4_1_demo
#> MWI_4_2_demo...98    MWI_3_2_demo  MWI_4_2_demo
#> MWI_4_3_demo...99    MWI_3_3_demo  MWI_4_3_demo
#> MWI_4_4_demo...100   MWI_3_4_demo  MWI_4_4_demo
#> MWI_4_6_demo...101   MWI_3_4_demo  MWI_4_6_demo
#> MWI_4_5_demo...102   MWI_3_5_demo  MWI_4_5_demo
#> MWI_4_7_demo...103   MWI_3_6_demo  MWI_4_7_demo
#> MWI_4_8_demo...104   MWI_3_7_demo  MWI_4_8_demo
#> MWI_4_9_demo...105   MWI_3_8_demo  MWI_4_9_demo
#> MWI_4_10_demo...106  MWI_3_9_demo MWI_4_10_demo
#> MWI_4_11_demo...107 MWI_3_10_demo MWI_4_11_demo
#> MWI_4_12_demo...108 MWI_3_11_demo MWI_4_12_demo
#> MWI_4_13_demo...109 MWI_3_12_demo MWI_4_13_demo
#> MWI_4_14_demo...110 MWI_3_13_demo MWI_4_14_demo
#> MWI_4_15_demo...111 MWI_3_13_demo MWI_4_15_demo
#> MWI_4_16_demo...112 MWI_3_14_demo MWI_4_16_demo
#> MWI_4_17_demo...113 MWI_3_15_demo MWI_4_17_demo
#> MWI_4_18_demo...114 MWI_3_16_demo MWI_4_18_demo
#> MWI_4_19_demo...115 MWI_3_17_demo MWI_4_19_demo
#> MWI_4_20_demo...116 MWI_3_18_demo MWI_4_20_demo
#> MWI_4_21_demo...117 MWI_3_19_demo MWI_4_21_demo
#> MWI_4_22_demo...118 MWI_3_19_demo MWI_4_22_demo
#> MWI_4_23_demo...119 MWI_3_20_demo MWI_4_23_demo
#> MWI_4_24_demo...120 MWI_3_21_demo MWI_4_24_demo
#> MWI_4_25_demo...121 MWI_3_22_demo MWI_4_25_demo
#> MWI_4_26_demo...122 MWI_3_23_demo MWI_4_26_demo
#> MWI_4_29_demo...123 MWI_3_23_demo MWI_4_29_demo
#> MWI_4_27_demo...124 MWI_3_24_demo MWI_4_27_demo
#> MWI_4_28_demo...125 MWI_3_25_demo MWI_4_28_demo
#> MWI_4_30_demo...126 MWI_3_26_demo MWI_4_30_demo
#> MWI_4_31_demo...127 MWI_3_27_demo MWI_4_31_demo
#> MWI_4_32_demo...128 MWI_3_28_demo MWI_4_32_demo
#> MWI_4_1_demo...129   MWI_4_1_demo  MWI_4_1_demo
#> MWI_4_2_demo...130   MWI_4_2_demo  MWI_4_2_demo
#> MWI_4_3_demo...131   MWI_4_3_demo  MWI_4_3_demo
#> MWI_4_4_demo...132   MWI_4_4_demo  MWI_4_4_demo
#> MWI_4_6_demo...133   MWI_4_6_demo  MWI_4_6_demo
#> MWI_4_5_demo...134   MWI_4_5_demo  MWI_4_5_demo
#> MWI_4_7_demo...135   MWI_4_7_demo  MWI_4_7_demo
#> MWI_4_8_demo...136   MWI_4_8_demo  MWI_4_8_demo
#> MWI_4_9_demo...137   MWI_4_9_demo  MWI_4_9_demo
#> MWI_4_10_demo...138 MWI_4_10_demo MWI_4_10_demo
#> MWI_4_11_demo...139 MWI_4_11_demo MWI_4_11_demo
#> MWI_4_12_demo...140 MWI_4_12_demo MWI_4_12_demo
#> MWI_4_13_demo...141 MWI_4_13_demo MWI_4_13_demo
#> MWI_4_14_demo...142 MWI_4_14_demo MWI_4_14_demo
#> MWI_4_15_demo...143 MWI_4_15_demo MWI_4_15_demo
#> MWI_4_16_demo...144 MWI_4_16_demo MWI_4_16_demo
#> MWI_4_17_demo...145 MWI_4_17_demo MWI_4_17_demo
#> MWI_4_18_demo...146 MWI_4_18_demo MWI_4_18_demo
#> MWI_4_19_demo...147 MWI_4_19_demo MWI_4_19_demo
#> MWI_4_20_demo...148 MWI_4_20_demo MWI_4_20_demo
#> MWI_4_21_demo...149 MWI_4_21_demo MWI_4_21_demo
#> MWI_4_22_demo...150 MWI_4_22_demo MWI_4_22_demo
#> MWI_4_23_demo...151 MWI_4_23_demo MWI_4_23_demo
#> MWI_4_24_demo...152 MWI_4_24_demo MWI_4_24_demo
#> MWI_4_25_demo...153 MWI_4_25_demo MWI_4_25_demo
#> MWI_4_26_demo...154 MWI_4_26_demo MWI_4_26_demo
#> MWI_4_29_demo...155 MWI_4_29_demo MWI_4_29_demo
#> MWI_4_27_demo...156 MWI_4_27_demo MWI_4_27_demo
#> MWI_4_28_demo...157 MWI_4_28_demo MWI_4_28_demo
#> MWI_4_30_demo...158 MWI_4_30_demo MWI_4_30_demo
#> MWI_4_31_demo...159 MWI_4_31_demo MWI_4_31_demo
#> MWI_4_32_demo...160 MWI_4_32_demo MWI_4_32_demo