so_ii_clc.R 1.02 KB
Newer Older
Grelot Frederic's avatar
Grelot Frederic committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# code to prepare `so_ii_clc` dataset goes here
library(sf)
so_ii_clc = readRDS("data-common/data/so-ii/so-ii_clc.rds")
so_ii_clc = so_ii_clc["clc_2018"]

clc_color = data.frame(
    color = scales::alpha(
        c(
            "red3",
            "darkolivegreen3",
            "darkgreen",
            "#4C90B4",
            "lightblue"
        ),
        .2
    ),
    label_fr = c(
        "Zone urbaine",
        "Zone agricole",
        "Forêt, zone naturelle",
        "Zone humide",
        "Surface d'eau"
    ),
    label_uk = c(
        "Urban area",
        "Agricultural area",
        "Forest, natural area",
        "Humid area",
        "Water surface"
    )
) 
so_ii_clc[["color"]] = as.character(
    cut(
        as.integer(substr(so_ii_clc[["clc_2018"]], 1, 1)), 
        breaks = 5,
        labels = clc_color[["color"]]
    )
)

# updating datasets

actual = setwd("so.ii")
usethis::use_data(so_ii_clc, internal = FALSE, overwrite = TRUE)
usethis::use_data(clc_color, internal = FALSE, overwrite = TRUE)
setwd(actual)