knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
In this vignette, we provide more detailed information on the data included in covidnor
, and demonstrate how to extract the data you need.
We have the following groups of Covid data, for certain combinations of time and location specifications.
There are two type of time granularity: day (date
) and week (isoyearweek
) in the data. For geo granularity, there are country (nation
), county (county
)and municipality (municip
). Note that not all outcomes of interest have municipality level data.
Population data has been attached to compute number of cases per 100.000 population for a certain location.
In this dataset we only provide total age groups and sex groups.
Cases are the PCR test confirmed Covid positive cases. We have the following variables:
cases_by_testdate_n
, cases_by_testdate_vs_pop_pr100000
cases_by_regdate_n
, cases_by_regdate_vs_pop_pr100000
Available for
Tests are the number of testing events. We have the following variables:
testevents_all_n
, testevents_pos_n
, testevents_neg_n
testevents_pos_vs_all_pr100
Available for
We provide two variables related to hospital admissions:
hospital_admissions_main_cause_n
; icu_admissions_n
. Available for
For vaccination we provide data for two dates: vaccination date and registration date. We have data on 4 doses. For each dose, we have the following (e.g. dose 1):
vax_dose_1_by_vaxdate_n
vax_dose_1_by_regdate_n
vax_dose_1_by_vaxdate_sum0_999999_n
Available for
Instead of working directly on total
data, you might want to use a certain combination of time, location, outcome. We recommend using the data.table syntax for data filtering and subsetting.
The way we organize time and location codes is documented in more detail in another csverse package, cstidy. We highly recommend you read through this vignette!
granularity_time
and granularity_geo
To get weekly Covid cases and hospital admissions as main cause for Norway (nation):
# load total data (419k rows) totaldata <- covidnor::total_b2020 # get weekly cases (confirmed) and hospitalisation for Norway case_hosp <- totaldata[granularity_time == 'isoyearweek' & granularity_geo == 'nation', .(date, location_name, cases = cases_by_testdate_n, hospital_adm = hospital_admissions_main_cause_n)] case_hosp[1:6,]
Get data for a certain date and location combination:
totaldata[date == '2021-12-10' & location_code %in% c('county_nor03', 'county_nor15'), .(date, location_name, cases = cases_by_testdate_n, vax_1 = vax_dose_1_by_vaxdate_n, vaxcum1 = vax_dose_1_by_vaxdate_sum0_999999_n)]
Can also get data for a whole calendar month, such as April 2022,
totaldata[calyearmonth == '2022-M04' & location_code == 'county_nor03', .(date, location_name, cases = cases_by_testdate_n)]
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.