-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobal.R
58 lines (45 loc) · 1.49 KB
/
global.R
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
46
47
48
49
50
51
52
53
54
55
56
57
58
# packages ----------------------------------------------------------------
# SHINY
library(shiny)
library(leaflet)
library(leaflet.providers)
library(highcharter) # remotes::install_github("jbkunst/highcharter")
library(shinyWidgets)
library(bslib)
# DATA
library(tidyverse)
library(sf)
# OTHERS
library(cli)
cli::cli_h1("Start global.R")
# data --------------------------------------------------------------------
# Leer datos bd_clusterizado.csv
data <- read.csv("data/bd_clusterizado.csv", sep = ",", header = TRUE) %>%
rename(cod_comuna = cut_com) |>
as_tibble()
# leer shape de comunas
dgeo <- st_read("data/Comunas/comunas.shp")
dgeo
# filtrar de comunas solo las que estan en la region de valparaiso
dgeo <- dgeo[dgeo$Region == "Región de Valparaíso",]
# options -----------------------------------------------------------------
parametros <- list(
color = "#236478",
font_family = "Raleway",
font_family_code = "Source Code Pro"
)
theme_odes <- bs_theme(
version = 5,
primary = parametros$color,
base_font = font_google(parametros$font_family),
code_font = font_google(parametros$font_family_code)
)
# options -----------------------------------------------------------------
opt_variables <- c(
"Índice Vulnerabilidad Económica y Social" = "ives",
"Edad" = "edad",
"Experiencia" = "experiencia",
"Dificultad por sequia ponderada" = "dificultad_por_sequia_pond"
)
# end ---------------------------------------------------------------------
cli::cli_h1("End global.R")