so_ii_catnat.R 709 Bytes
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
# code to prepare `so_ii_catnat` dataset goes here

so_ii_catnat = read.csv2(
    geau::current_version("data-common/so-ii/gaspar", "catnat-")
)

alea_scope = c("inondation", "nappe", "submersion")
so_ii_catnat = so_ii_catnat[ so_ii_catnat[["alea"]] %in% alea_scope, ]

so_ii_catnat[["commune"]] = factor(
    so_ii_catnat[["commune"]],
    levels = so_ii_scope
)
so_ii_catnat[["alea"]] = factor(
    so_ii_catnat[["alea"]],
    levels = alea_scope
)

so_ii_catnat = estimate_catnat_freq(
    so_ii_catnat[["commune"]],
    so_ii_catnat[["date.start"]],
    so_ii_catnat[["alea"]]
)

# updating datasets

actual = setwd("geau")
usethis::use_data(so_ii_catnat, internal = FALSE, overwrite = TRUE)
setwd(actual)