-
Notifications
You must be signed in to change notification settings - Fork 0
/
global.R
24 lines (21 loc) · 915 Bytes
/
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
library(shiny)
library(leaflet)
library(dplyr)
library(coronavirus)
## Cargar datos
datacov2 <- coronavirus %>%
select(country = Country.Region, type, cases, Lat, Long) %>%
group_by(country, Lat, Long, type) %>%
summarise(total_cases = sum(cases)) %>%
pivot_wider(names_from = type, values_from = total_cases) %>%
arrange(-confirmed) %>%
mutate(deadRate = death/confirmed * 100) %>%
ungroup()
# Cambios de nombres a español
datacov2 <- datacov2 %>%
mutate(country = ifelse(country == "Peru", "Perú", country)) %>%
mutate(country = ifelse(country == "Dominican Republic", "República Dominicana", country)) %>%
mutate(country = ifelse(country == "Brazil", "Brasil", country)) %>%
mutate(country = ifelse(country == "Haiti", "Haití", country)) %>%
mutate(country = ifelse(country == "Panama", "Panamá", country)) %>%
mutate(country = ifelse(country == "Mexico", "México", country))