CreateBaselineMatrix: Create and save a baseline matrix

View source: R/Init.r

CreateBaselineMatrixR Documentation

Create and save a baseline matrix

Description

Compute and save on disk a 2D dense matrix representing the baseline, given a data.frame of events (case.df), where rows represent the spatial component of the baseline (indexed, e.g., by postcodes) and columns represent the temporal component. It is possible to insert null rows corresponding to postcodes not included in case.df using more.postcodes field for increased accuracy.

Usage

CreateBaselineMatrix(
  case.df,
  save.on.dir = FALSE,
  date.time.field = "week",
  postcode.field = "postcode",
  more.postcodes = c(),
  more.weeks = c()
)

Arguments

case.df

A data.frame of events.

save.on.dir

logical. If TRUE then the vector is saved in 'baseline_matrix.RData' file.

date.time.field

A character string.

postcode.field

A character string.

more.postcodes

A character vector of postcodes.

more.weeks

A integer vector of postcodes.

Value

A Matrix.

Examples

baseline.matrix = CreateBaselineMatrix(case.df, more.postcodes=c('CV31 1LS', 'E1 3BS'))
baseline.matrix = CreateBaselineMatrix(case.df, date.time.field = 'SAMPLE_DT_numeric', postcode.field = 'Patient Postcode')

mcavallaro/rancovr documentation built on April 17, 2025, 7:21 p.m.