The function crosswalk()
provides an easy mapping from
habitat codes in one classification system to another.
From EUNIS 2012 to EUNIS Marine 2022
crosswalk(
code = c("A3.4", "A3.5"),
from = "EUNIS_2012",
to = "EUNIS_M_2022",
unnest = TRUE
)
#> # A tibble: 64 × 2
#> eunis_2012_code eunis_m_2022_code
#> <chr> <chr>
#> 1 A3.4 MA133
#> 2 A3.4 MA134
#> 3 A3.4 MA135
#> 4 A3.4 MA136
#> 5 A3.4 MA137
#> 6 A3.4 MB13
#> 7 A3.4 MB131
#> 8 A3.4 MB1311
#> 9 A3.4 MB1312
#> 10 A3.4 MB1313
#> # ℹ 54 more rows
One to many mappings
Note that some mappings are one to many, e.g. "MA12"
in
EUNIS Marine 2019 maps to the following Habitats Directive Annex
I habitat codes: "8330"
, "1160"
,
"1170"
and "1130"
. That is why, by default,
the to column is a list-column.
crosswalk(
code = c("M", "MA1", "MA11", "MA12"),
from = "EUNIS_M_2019",
to = "Annex_I"
)
#> # A tibble: 4 × 2
#> eunis_m_2019_code annex_i_code
#> <chr> <list>
#> 1 M <chr [1]>
#> 2 MA1 <chr [1]>
#> 3 MA11 <chr [1]>
#> 4 MA12 <chr [4]>
You need to use unnest = TRUE
to flatten out the table
of mappings and convert the to list-column to a character
vector column.