Constructs and validates an areas object as an S3 class.

create_areas(
  levels = NULL,
  hierarchy = NULL,
  boundaries = NULL,
  area_merged = NULL
)

Arguments

levels

Data frame of area level metadata.

hierarchy

Data frame defining area hierarchy and area-level data.

boundaries

an sf object with boundary geometry for each area_id

area_merged

A merged version of levels, hierarchy, and boundaries.

Value

An object of class naomi_areas

Examples

data(demo_area_levels)
data(demo_area_hierarchy)
data(demo_area_boundaries)

areas <- create_areas(demo_area_levels, demo_area_hierarchy, demo_area_boundaries)
areas
#>                        levelName     area_name
#> 1  MWI                           Malawi - Demo
#> 2   ¦--MWI_1_1_demo                   Northern
#> 3   ¦   °--MWI_2_1_demo               Northern
#> 4   ¦       ¦--MWI_3_1_demo            Chitipa
#> 5   ¦       ¦   °--MWI_4_1_demo        Chitipa
#> 6   ¦       ¦--MWI_3_2_demo            Karonga
#> 7   ¦       ¦   °--MWI_4_2_demo        Karonga
#> 8   ¦       ¦--MWI_3_3_demo             Rumphi
#> 9   ¦       ¦   °--MWI_4_3_demo         Rumphi
#> 10  ¦       ¦--MWI_3_4_demo             Mzimba
#> 11  ¦       ¦   ¦--MWI_4_4_demo     Mzuzu City
#> 12  ¦       ¦   °--MWI_4_6_demo         Mzimba
#> 13  ¦       ¦--MWI_3_5_demo         Nkhata Bay
#> 14  ¦       ¦   °--MWI_4_5_demo     Nkhata Bay
#> 15  ¦       °--MWI_3_6_demo             Likoma
#> 16  ¦           °--MWI_4_7_demo         Likoma
#> 17  ¦--MWI_1_2_demo                    Central
#> 18  ¦   ¦--MWI_2_2_demo           Central-East
#> 19  ¦   ¦   ¦--MWI_3_7_demo         Nkhotakota
#> 20  ¦   ¦   ¦   °--MWI_4_8_demo     Nkhotakota
#> 21  ¦   ¦   ¦--MWI_3_8_demo            Kasungu
#> 22  ¦   ¦   ¦   °--MWI_4_9_demo        Kasungu
#> 23  ¦   ¦   ¦--MWI_3_9_demo            Ntchisi
#> 24  ¦   ¦   ¦   °--MWI_4_10_demo       Ntchisi
#> 25  ¦   ¦   ¦--MWI_3_10_demo              Dowa
#> 26  ¦   ¦   ¦   °--MWI_4_11_demo          Dowa
#> 27  ¦   ¦   °--MWI_3_11_demo            Salima
#> 28  ¦   ¦       °--MWI_4_12_demo        Salima
#> 29  ¦   °--MWI_2_3_demo           Central-West
#> 30  ¦       ¦--MWI_3_12_demo           Mchinji
#> 31  ¦       ¦   °--MWI_4_13_demo       Mchinji
#> 32  ¦       ¦--MWI_3_13_demo          Lilongwe
#> 33  ¦       ¦   ¦--MWI_4_14_demo Lilongwe City
#> 34  ¦       ¦   °--MWI_4_15_demo      Lilongwe
#> 35  ¦       ¦--MWI_3_14_demo             Dedza
#> 36  ¦       ¦   °--MWI_4_16_demo         Dedza
#> 37  ¦       °--MWI_3_15_demo            Ntcheu
#> 38  ¦           °--MWI_4_17_demo        Ntcheu
#> 39  °--MWI_1_3_demo                   Southern
#> 40      ¦--MWI_2_4_demo             South-East
#> 41      ¦   ¦--MWI_3_16_demo          Mangochi
#> 42      ¦   ¦   °--MWI_4_18_demo      Mangochi
#> 43      ¦   ¦--MWI_3_17_demo          Machinga
#> 44      ¦   ¦   °--MWI_4_19_demo      Machinga
#> 45      ¦   ¦--MWI_3_18_demo            Balaka
#> 46      ¦   ¦   °--MWI_4_20_demo        Balaka
#> 47      ¦   ¦--MWI_3_19_demo             Zomba
#> 48      ¦   ¦   ¦--MWI_4_21_demo    Zomba City
#> 49      ¦   ¦   °--MWI_4_22_demo         Zomba
#> 50      ¦   ¦--MWI_3_20_demo          Phalombe
#> 51      ¦   ¦   °--MWI_4_23_demo      Phalombe
#> 52      ¦   °--MWI_3_21_demo           Mulanje
#> 53      ¦       °--MWI_4_24_demo       Mulanje
#> 54      °--MWI_2_5_demo             South-West
#> 55          ¦--MWI_3_22_demo              Neno
#> 56          ¦   °--MWI_4_25_demo          Neno
#> 57          ¦--MWI_3_23_demo          Blantyre
#> 58          ¦   ¦--MWI_4_26_demo      Blantyre
#> 59          ¦   °--MWI_4_29_demo Blantyre City
#> 60          ¦--MWI_3_24_demo            Mwanza
#> 61          ¦   °--MWI_4_27_demo        Mwanza
#> 62          ¦--MWI_3_25_demo        Chiradzulu
#> 63          ¦   °--MWI_4_28_demo    Chiradzulu
#> 64          ¦--MWI_3_26_demo            Thyolo
#> 65          ¦   °--MWI_4_30_demo        Thyolo
#> 66          ¦--MWI_3_27_demo          Chikwawa
#> 67          ¦   °--MWI_4_31_demo      Chikwawa
#> 68          °--MWI_3_28_demo            Nsanje
#> 69              °--MWI_4_32_demo        Nsanje