Untitled

Anonymous
plain_text
05/06/2026 6:23 PM
760 B
12
Indexable
library(readxl)
library(dplyr)
library(tidyr)
library(stringr)

df_IUCN_to_LC_categ <- read_excel("./03_data/inputs/tables/Leyenda_Corine_ESA_Habitat_IUCN.xlsx")

head(df_IUCN_to_LC_categ)

df_IUCN_to_ESA_categ <- df_IUCN_to_LC_categ |> count(HABITAT_IUCN, ESA_cod, ESA_cov) |> 
  separate_rows(HABITAT_IUCN, sep="; ") |> 
  mutate(code = gsub("\\.$" , "" , str_extract( HABITAT_IUCN, "\\d*\\.*\\d*")) , .before = HABITAT_IUCN) |> select(-n)

head(df_IUCN_to_ESA_categ)

write.csv(df_IUCN_to_ESA_categ, "./03_data/inputs/tables/df_IUCN_to_ESA_categ.csv", row.names = F)
Editor is loading...
Leave a Comment