Learn R Programming

polypharmacy (version 1.0.0)

ind_simult: Assess polypharmacy based on the daily simultaneous consumption of medications

Description

Calculates various metrics measuring the number of distinct medications consumed daily for every individual of the study cohort over the study period and provides cohort descriptive statistics on those metrics.

Usage

ind_simult(
  processed_tab,
  individual_stats = c("mean", "min", "median", "max"),
  stats = c("mean", "sd", "min", "p5", "p10", "p25", "median", "p75", "p90", "p95",
    "max"),
  calendar = FALSE,
  cores = parallel::detectCores()
)

Arguments

processed_tab

Table of individual drug treatments over the study period. Created by data_process function.

individual_stats

Descriptive statistics of daily consumption over the study period to calculate for every individual. See Details for possible values.

stats

Cohort descriptive statistics to calculate on the polypharmacy indicator. See Details for possible values.

calendar

TRUE or FALSE. Create a table of the number of drugs consumed everyday by every individual (FALSE by default).

cores

The number of CPU cores to use. See detectCores.

Value

list:

  • indic: data.table indicating each stats (columns) for each individual_stats (rows).

  • stats_id: data.table indicating each individual_stats for each individuals (all cohort).

  • min_conso: data.table indicating each stats for the number of days where an individual consume at least X drugs.

  • calendar: If calendar=TRUE, data.table indicating the number of drugs consumed for each day (only for individuals who has at least 1 day with 1 drug consumption).

Details

individual_stats & stats: Possible values are

  • 'mean', 'min', 'median', 'max', 'sd';

  • 'pX' where X is an integer value in ]0, 100];

  • 'q1'='p25', 'q2'='p50'='median', q3='p75'.

Examples

Run this code
# NOT RUN {
rx1 <- data.frame(id = c(1, 1, 2),
                  code = c("A", "B", "A"),
                  date = c("2000-01-01", "2000-01-04", "2000-01-08"),
                  duration = c(5, 7, 5))
cohort1 <- data.frame(id = as.numeric(1:3),
                      age = c(45, 12, 89),
                      sex = c("F", "F", "M"))
rx_proc1 <- data_process(Rx_deliv = rx1, Rx_id = "id", Rx_drug_code = "code",
                         Rx_drug_deliv = "date", Rx_deliv_dur = "duration",
                         Cohort = cohort1, Cohort_id = "id",
                         study_start = "2000-01-01", study_end = "2000-01-15",
                         cores = 1)
dt_ind_simult <- ind_simult(rx_proc1, calendar = TRUE, cores = 1)
# }

Run the code above in your browser using DataLab