-
Notifications
You must be signed in to change notification settings - Fork 92
/
ds_gov.si.R
40 lines (36 loc) · 1.07 KB
/
ds_gov.si.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
#' Ministry of Health and National Institute for Public health
#'
#' Data source for: Slovenia
#'
#' @param level 1
#'
#' @section Level 1:
#' - confirmed cases
#' - deaths
#' - tests
#' - hospitalizations
#' - intensive care
#'
#' @source https://www.gov.si/en/topics/coronavirus-disease-covid-19/actual-data/
#'
#' @keywords internal
#'
gov.si <- function(level){
if(level!=1) return(NULL)
# download
url <- 'https://www.gov.si/assets/vlada/Koronavirus-podatki/EN_Covid-19-all-data-v2.xlsx'
x <- read.excel(url, sheet = 1)
# format
x <- map_data(x, c(
'Date' = 'date',
'Tested (all)' = 'tests',
'Positive (all)' = 'confirmed',
'All hospitalized on certain day' = 'hosp',
'All persons in intensive care on certain day' = 'icu',
'Deaths (all)' = 'deaths'
))
# clean date
x$date <- as.Date(suppressWarnings(as.numeric(x$date)), origin = "1899-12-30")
x <- x[!is.na(x$date),]
return(x)
}