library(exactextractr)
library(sf)
library(terra)
library(tidyterra)
library(tidyverse)
<- rast(system.file('sao_miguel/clc2018_v2020_20u1.tif',
classification package = 'exactextractr'))
print(unique(classification$LABEL3))
LABEL3
1 Continuous urban fabric
2 Discontinuous urban fabric
3 Industrial or commercial units
4 Port areas
5 Airports
6 Mineral extraction sites
7 Dump sites
8 Construction sites
9 Green urban areas
10 Sport and leisure facilities
11 Non-irrigated arable land
12 Fruit trees and berry plantations
13 Pastures
14 Complex cultivation patterns
15 Land principally occupied by agriculture, with significant areas of natural vegetation
16 Broad-leaved forest
17 Coniferous forest
18 Mixed forest
19 Natural grasslands
20 Moors and heathland
21 Transitional woodland-shrub
22 Water bodies
23 Sea and ocean
<-classification%>%
Grouped_Classification::mutate(LABEL3=case_when(
tidyterra%in%c("Continuous urban fabric",
LABEL3"Discontinuous urban fabric",
"Industrial or commercial units",
"Port areas",
"Airports",
"Mineral extraction sites",
"Dump sites",
"Construction sites",
"Green urban areas",
"Sport and leisure facilities")~"Urban",
%in%c("Broad-leaved forest",
LABEL3"Coniferous forest",
"Mixed forest",
"Natural grasslands",
"Moors and heathland",
"Transitional woodland-shrub")~"Wild Vegetation",
%in%c("Water bodies",
LABEL3"Sea and ocean")~"Ocean/Water Body",
TRUE~"Farmland")
)