Skip to content

Commit

Permalink
Merge pull request #176 from chitrams/update-prem-174
Browse files Browse the repository at this point in the history
Update Prem's Germany contact matrices 174
  • Loading branch information
MikeLydeamore authored Dec 2, 2024
2 parents 86a8702 + a3c311b commit 1c90a1c
Show file tree
Hide file tree
Showing 21 changed files with 23 additions and 13 deletions.
9 changes: 6 additions & 3 deletions R/data_prem_contact_matrices.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' Contact matrices as calculated by Prem. et al.
#'
#' Contact matrices as calculated by Prem. et al. PLoS Computational Biology.
#' DOI: 10.1371/journal.pcbi.1005697
#' Contact matrices as calculated by Prem. et al. (2021) PLoS Computational Biology. Updated to use the latest corrected matrices from their 2021 publication.
#' DOI: 10.1371/journal.pcbi.1009098
#'
#' @format A list with 5 elements:
#' \describe{
Expand All @@ -13,8 +13,11 @@
#' year age group}
#' \item{other}{A 16x16 matrix containing the number of other contacts, by 5
#' year age group}
#' \item{all}{A 16x16 matrix containing the number of all contacts, by 5
#' year age group}
#' }
#' All age groups are 5 year age bands, from 0 to 80.
#'
#' @source \url{https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1005697}
#' @source \url{https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1009098}
#' @source \url{https://github.com/kieshaprem/synthetic-contact-matrices}
"prem_germany_contact_matrices"
Binary file removed data-raw/prem/MUestimates_home_1.xlsx
Binary file not shown.
Binary file removed data-raw/prem/MUestimates_other_locations_1.xlsx
Binary file not shown.
Binary file removed data-raw/prem/MUestimates_school_1.xlsx
Binary file not shown.
Binary file removed data-raw/prem/MUestimates_work_1.xlsx
Binary file not shown.
Binary file added data-raw/prem/contact_all.rdata
Binary file not shown.
Binary file added data-raw/prem/contact_home.rdata
Binary file not shown.
Binary file added data-raw/prem/contact_others.rdata
Binary file not shown.
Binary file added data-raw/prem/contact_school.rdata
Binary file not shown.
Binary file added data-raw/prem/contact_work.rdata
Binary file not shown.
Binary file added data-raw/prem/rural/contact_all_rural.rdata
Binary file not shown.
Binary file added data-raw/prem/rural/contact_home_rural.rdata
Binary file not shown.
Binary file added data-raw/prem/rural/contact_others_rural.rdata
Binary file not shown.
Binary file added data-raw/prem/rural/contact_school_rural.rdata
Binary file not shown.
Binary file added data-raw/prem/rural/contact_work_rural.rdata
Binary file not shown.
Binary file added data-raw/prem/urban/contact_all_urban.rdata
Binary file not shown.
Binary file added data-raw/prem/urban/contact_home_urban.rdata
Binary file not shown.
Binary file added data-raw/prem/urban/contact_others_urban.rdata
Binary file not shown.
Binary file added data-raw/prem/urban/contact_school_urban.rdata
Binary file not shown.
Binary file added data-raw/prem/urban/contact_work_urban.rdata
Binary file not shown.
27 changes: 17 additions & 10 deletions data-raw/prem_germany_contact_matrices.R
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
# Loads in the Prem matrices for Germany, taken from the 2015 paper.
# Loads in the Prem matrices for Germany, taken from the 2021 paper.

prem_home <- readxl::read_xlsx("data-raw/prem/MUestimates_home_1.xlsx", sheet = "Germany") %>%
as.matrix() %>%
load("data-raw/prem/contact_home.rdata")
load("data-raw/prem/contact_work.rdata")
load("data-raw/prem/contact_school.rdata")
load("data-raw/prem/contact_others.rdata")
load("data-raw/prem/contact_all.rdata")

# ISO3 code for Germany is DEU

prem_home <- contact_home[["DEU"]] %>%
t()

prem_work <- contact_work[["DEU"]] %>%
t()

prem_school <- readxl::read_xlsx("data-raw/prem/MUestimates_school_1.xlsx", sheet = "Germany") %>%
as.matrix() %>%
prem_school <- contact_school[["DEU"]] %>%
t()

prem_work <- readxl::read_xlsx("data-raw/prem/MUestimates_work_1.xlsx", sheet = "Germany") %>%
as.matrix() %>%
prem_other <- contact_others[["DEU"]] %>%
t()

prem_other <- readxl::read_xlsx("data-raw/prem/MUestimates_other_locations_1.xlsx", sheet = "Germany") %>%
as.matrix() %>%
prem_all <- contact_all[["DEU"]] %>%
t()

prem_germany_contact_matrices <- list(
"home" = prem_home,
"work" = prem_work,
"school" = prem_school,
"other" = prem_other,
"all" = prem_home + prem_work + prem_school + prem_other
"all" = prem_all
)

usethis::use_data(prem_germany_contact_matrices, overwrite = TRUE)

0 comments on commit 1c90a1c

Please sign in to comment.