pipe: Baja los datos sobre covid de la Secretaría de salud

Description Usage Examples

Description

The data frame contains FECHA_INGRESO, n = number of cases, cumsum = cumulative sum

The data frame contains FECHA_INGRESO, n = number of cases, cumsum = cumulative sum for covid positive cases

Usage

1
2
3
4
5
6
7
8
9

Examples

 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
downloadCovidmx()
## Print plots for all states
data('COVID19MEXICO_EXAMPLE')
d = COVID19MEXICO_EXAMPLE
covid19mx::varDicHealth()

rm(list=grep(pattern = "timeline_estado_.*", ls(), value = TRUE))
estados = unique(d$ENTIDAD_RES)
sapply(1:length(estados), timelineByState)

timelines = grep(pattern = "timeline_estado_.*", ls(), value = TRUE)
sapply(timelines, function(tl){
  main = gsub(pattern = "timeline_estado_", x = tl, replacement = "")
  main = gsub(pattern = "_fecha_ingreso", x = main, replacement = ""  )
  main = gsub(pattern = "_", x = main, replacement = " "  )
  main = paste0(main,' - Positivo SARS-CoV-2')
  print(
  ggplot2::ggplot(data = get(tl), ggplot2::aes(x = FECHA_INGRESO,y = cumsum)) + 
   ggplot2::geom_line() +
   ggplot2::ggtitle(main) +
   ggplot2::ylab('Casos acumulados') +
   ggplot2::xlab('Fecha de ingreso a la unidad de atención')
   )
   })
## Print plots for all states
data('COVID19MEXICO_EXAMPLE')
d = COVID19MEXICO_EXAMPLE
covid19mx::varDicHealth()

rm(list=grep(pattern = "timeline_municipio_.*", ls(), value = TRUE))
municipiosCDMX = unique(d [ d$ENTIDAD_RES == "20", c("ENTIDAD_RES","MUNICIPIO_RES")])
sapply(1:nrow(municipiosCDMX), function(r){ 
covid19mx::timelineByMunicipio(municipiosCDMX[r,"ENTIDAD_RES"]
                              , municipiosCDMX[r,"MUNICIPIO_RES"])
                              })

timelines = grep(pattern = "tlm_.*", ls(), value = TRUE)
sapply(timelines, function(tl){
  main = gsub(pattern = "tlm_", x = tl, replacement = "")
  main = gsub(pattern = "_fi", x = main, replacement = ""  )
  main = gsub(pattern = "_", x = main, replacement = " "  )
  main = paste0(main,' - Positivo SARS-CoV-2')
  print(
  ggplot2::ggplot(data = get(tl), ggplot2::aes(x = FECHA_INGRESO,y = cumsum)) + 
   ggplot2::geom_line() +
   ggplot2::ggtitle(main) +
   ggplot2::ylab('Casos acumulados') +
   ggplot2::xlab('Fecha de ingreso a la unidad de atención')
   )
   })

rjof/covid19mx documentation built on May 20, 2020, 3:45 a.m.