Last active
November 16, 2022 15:58
-
-
Save kathsherratt/3d557ed89a6ec8041cdb91f1276cc7d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a template scenario projection | |
library(dplyr) | |
library(tidyr) | |
library(readr) | |
# Variables | |
origin_date <- as.Date("2022-05-22") | |
scenario_id <- paste0(c("A", "B", "C", "D"), "-", origin_date) | |
age_group <- c("0-15", "16-64", "65-130", "0-130") | |
target_variables <- c("inc case", "inc hosp", "inc death", "inc inf") | |
location <- read_csv(here("data-locations", "locations_eu.csv"))$location | |
horizon <- 1:52 | |
sample <- 1:100 | |
# check total number of rows | |
rows <- length(scenario_id) * length(age_group) * length(target_variables) * length(location) * length(horizon) * length(sample) | |
# create dataframe | |
grid <- expand_grid(origin_date, scenario_id, age_group, | |
location, horizon, | |
target_variables, sample) |> | |
mutate(value = sample.int(10, rows, replace = TRUE)) | |
# write | |
write_csv(grid, "2022-05-22.csv.gz") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment