load_infections_paneldata: Import of infections panel data

View source: R/swash.R

load_infections_paneldataR Documentation

Import of infections panel data

Description

Loading infections panel data (data.frame) and creating an object of class infpan

Usage

load_infections_paneldata(
  data,
  col_cases, 
  col_date, 
  col_region,
  other_cols = NULL,
  time_format = "%Y-%m-%d",
  time_unit = "days",
  verbose = FALSE
  )

Arguments

data

data.frame with regional infection data

col_cases

character, Column containing the cases (numeric)

col_date

character, Column containing the time points (e.g., days)

col_region

character, Column containing the unique identifier of the regions (e.g., name, NUTS 3 code)

other_cols

list, Further columns in the input data

time_format

character, Time format of the values in col_date

time_unit

character, Time unit of the values in col_date, e.g., "days"

verbose

bool argument which indicates whether progress messages are displayed

Details

The function import user-given infections panel data. The input data is checked in several ways (e.g., whether data is balanced or not). Other relevant columns from the input data may be defined in the character vector other_cols: "R_t" (Effective reproduction number), "Cum. cases" (Cumulative cases), "Incidence" Incidence (per xxx pop), "Population" (Population size of the region), "Roll. mean" (Rolling mean of cases), and "Roll. sum" (Rolling sum of cases).

The output is an object of class infpan. The results can be viewed using summary(infpan). From an instance of class infpan, all built-in analyses for infections panel data may be conducted, e.g., the Swash-Backwash Model (swash(infpan)) or logistic growth models (growth(infpan)).

Value

object of class infpan-class

Author(s)

Thomas Wieland

References

Wieland T (2020) Flatten the Curve! Modeling SARS-CoV-2/COVID-19 Growth in Germany at the County Level. REGION 7(2), 43–83. \Sexpr[results=rd]{tools:::Rd_expr_doi("https://doi.org/10.18335/region.v7i2.324")}

Wieland T (2025) Assessing the effectiveness of non-pharmaceutical interventions in the SARS-CoV-2 pandemic: results of a natural experiment regarding Baden-Württemberg (Germany) and Switzerland in the second infection wave. Journal of Public Health 33(11), 2497-2511. \Sexpr[results=rd]{tools:::Rd_expr_doi("https://doi.org/10.1007/s10389-024-02218-x")}

See Also

infpan-class

Examples

data(COVID19Cases_geoRegion)
# Get SWISS COVID19 cases at NUTS 3 level

COVID19Cases_geoRegion <- 
  COVID19Cases_geoRegion[!COVID19Cases_geoRegion$geoRegion %in% c("CH", "CHFL"),]
# Exclude CH = Switzerland total and CHFL = Switzerland and Liechtenstein total

COVID19Cases_geoRegion <- 
  COVID19Cases_geoRegion[COVID19Cases_geoRegion$datum <= "2020-05-31",]
# Extract first COVID-19 wave

infpan_CH <- load_infections_paneldata(
    data = COVID19Cases_geoRegion,
    col_cases = "entries",
    col_date = "datum",
    col_region = "geoRegion",
    other_cols = c("Population" = "pop"), 
    verbose = TRUE
  )
# Import as infections panel data set (class infpan)

CH_covidwave1 <-
  swash(
    infpan_CH,
    verbose = TRUE
    )
# Swash-Backwash Model for Swiss COVID19 cases
# Spatial aggregate: NUTS 3 (cantons)

summary(CH_covidwave1)
# Summary of Swash-Backwash Model

swash documentation built on April 7, 2026, 1:06 a.m.