ita_prepare_covariate: Prepare an Italy covariate for modeling

Description Usage Arguments Value

View source: R/ita_covariate_prep_functions.R

Description

Generic function to prepare a covariate for modeling. This function is a wrapper for sub-functions called for specific covariates and will fail if a non-initialized covariate has been passed. It returns both the prepared covariate and a vector of expected indices that can be used to merge back onto the original dataset.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
ita_prepare_covariate(
  covar_name,
  covar_fp,
  model_years,
  location_table,
  pop_raster = NULL,
  polys_sf = NULL,
  projection = NULL,
  final_obs_week = NULL
)

Arguments

covar_name

Short name for the covariate. This will be used to send the covariate to a particular prep function.

covar_fp

Filepath to the raw covariate

model_years

Vector of years to consider for modeling

location_table

Location code merge table for Italy

pop_raster

[optional] Population rasterBrick object, with one layer per modeling year. Only used to prepare raster covariates, default NULL.

polys_sf

[optional] Polygon boundaries

projection

[optional] Character vector giving the proj4 CRS definition. Example: "+proj=utm +zone=32 +datum=WGS84 +units=m +no_defs"

final_obs_week

[optional] ID for the final observed week in 2020, formatted as an integer between 1 and 52 inclusive.

Value

A list of two items: - "prepped_covar": data.table containing the prepped covariate - "covar_indices": Vector of identifiers that should be used to merge onto the modeling dataset. The prepared covariate dataset should only include identifier columns and the covariate value, specified by the covariate name


njhenry/covidemr documentation built on Feb. 2, 2022, 2:31 a.m.