createHospitalTimeBlocks: Calculates block data for hospitalisations

View source: R/createHospitalisationTimeBlocks.R

createHospitalTimeBlocksR Documentation

Calculates block data for hospitalisations

Description

Calculates block data for hospitalisations

Usage

createHospitalTimeBlocks(
  serialDf,
  baselineInfo,
  studyStartDate,
  studyEndDate,
  blockDays = 365.25,
  blDayDiff = 90,
  idColumn = "PATIENT",
  startDateColumn = "VISIT_START",
  endDateColumn = "VISIT_END",
  countNights = TRUE,
  blDateColumn = "VISIT",
  longFormat = TRUE
)

Arguments

serialDf

the data frame with the hospital events (one row per event)

baselineInfo

dataframe with ID and baseline date

studyStartDate

start Date of the study (has to be of class Date)

studyEndDate

end Date of the study (has to be of class Date)

blockDays

length of a time block in days (default 365.25 days)

blDayDiff

time in days that should be searched for a measurement around the baseline visit (default 90)

idColumn

name of ID column: default is PATIENT

startDateColumn

name of start date column (day of hospitalisation or outpatient visit): default is VISIT_START. This column has to be of class Date

endDateColumn

name of end date column (release date): default is VISIT_END. This column has to be of class Date

countNights

flag indicating whether to count the days in hospital or the night: default TRUE, count nights (if nights are counted, an outpatient stay has length 0, otherwise 1)

blDateColumn

name of the column containing the baseline date (date has to be of class Date): default is VISIT

longFormat

flag to indicate whether results should be in long or wide format. Wide has some additional columns (default: TRUE)

Value

time block data and dates in wide format


smm52/timeBlocks documentation built on Nov. 27, 2022, 3:54 a.m.