calDDDsRange: Calculate subjects' accumulated daily dosage drugs(DDDs) in...

View source: R/calDDDsRange.R

calDDDsRangeR Documentation

Calculate subjects' accumulated daily dosage drugs(DDDs) in custom interval period

Description

calDDDsRange is a function to calculate subjects' accumulated daily dosage drugs(DDDs) in RxCui in custom interval period getDDDs is a function to get DDDs in ATC code

Usage

calDDDsRange(
  case,
  index_dayColName = Index_Day,
  expo_range_before = 36000,
  expo_range_after = 36000,
  idColName = MemberId,
  AtcCodeColName = ATC,
  DispenseDateColName = DispenseDate,
  DaysSupplyColName = DaysSupply,
  DailyDosageColName = DailyDosage
)

Arguments

case

data.frame include subjects' id, dispensing date, drug ATC code, daily dosage, duration

expo_range_before

days before observation day

expo_range_after

days after observation day

idColName

a column name for subject's id

DispenseDateColName

a column name for dispensing

DaysSupplyColName

a column name for supply day

DailyDosageColName

a column name for DDDs

index_day

observation day

Details

User can get the total amount of DDDs accumulated of patients before and after a specific date in a custom interval period or specific date.

Value

A new data.table index_DDD with following columns.

MemberId patient Id

Start_day the begin date of patient take medicine

Index_Day the begin date of calculating the DDDs

End_day the end date of patient take medicine

DDDs_Before_15_Days calculate DDDs in custom time interval before index 15 day

DDDs_After_30_Days calculate DDDs in custom time interval after index 30 day

Examples

# sample of calculating subjects' accumulated DDDs in a custom interval period
index_DDD <- calDDDsRange(case = sample_data_subset_atc,index_dayColName = Index_Day,expo_range_before = 15,expo_range_after = 30,idColName = MemberId,AtcCodeColName = ATC,DispenseDateColName = DispenseDate,DaysSupplyColName = DaysSupply,DailyDosageColName = DailyDosage)
head(index_DDD)

DHLab-CGU/pharm documentation built on July 2, 2022, 7:16 a.m.