Last chance! 50% off unlimited learning
Sale ends in
#'########################################################################### Function to estimate the cost of patches when IPD is in long format using a IPD data of long format
costing_opioid_patches_averageMED_long(
the_columns,
ind_part_data_long,
name_med,
brand_med = NULL,
dose_med,
unit_med = NULL,
no_taken,
freq_taken,
timeperiod,
unit_cost_data,
unit_cost_column,
cost_calculated_per,
strength_column,
list_of_code_names = NULL,
list_of_code_freq = NULL,
list_of_code_dose_unit = NULL,
list_of_code_brand = NULL,
eqdose_cov_tab = NULL,
basis_strength_unit = NULL
)
the calculated cost of tablets along with original data
columns that are to be used to convert the data from long to wide
IPD
name of medication
brand name of medication if revealed
dose of medication used
unit of medication ; use null if its along with the dose
how many taken
frequency of medication
time period for cost calculation
unit costs data
column name of unit cost in unit_cost_data
column name of unit in the cost is calculated
column column name that contain strength of medication
if names is coded, give the code:name pairs, optional
if frequency is coded, give the code:frequency pairs, optional
if unit is coded, give the code:unit pairs, optional
if brand names are coded, give the code:brand pairs, optional
table to get the conversion factor for equivalent doses, optional
strength unit to be taken as basis required for total medication calculations
med_costs_file <- system.file("extdata", "medicaton_costs_all.xlsx",
package = "packDAMipd")
data_file <- system.file("extdata", "medication.xlsx",
package = "packDAMipd")
ind_part_data <- load_trial_data(data_file)
med_costs <- load_trial_data(med_costs_file)
conv_file <- system.file("extdata", "Med_calc.xlsx",package = "packDAMipd")
table <- load_trial_data(conv_file)
names <- colnames(ind_part_data)
ending <- length(names)
ind_part_data_long <- tidyr::gather(ind_part_data, measurement, value,
names[2]:names[ending], factor_key = TRUE)
the_columns <- c("measurement", "value")
res <- costing_opioid_patches_averageMED_long(the_columns,
ind_part_data_long = ind_part_data_long, name_med = "patch_name",
brand_med = "patch_brand", dose_med = "patch_strength",unit_med = NULL,
no_taken = "patch_no_taken", freq_taken = "patch_frequency",
timeperiod = "4 months", unit_cost_data = med_costs,
unit_cost_column = "UnitCost", cost_calculated_per = "Basis",
strength_column = "Strength", list_of_code_names = NULL,
list_of_code_freq = NULL, list_of_code_dose_unit = NULL,
list_of_code_brand = NULL, eqdose_cov_tab = table,
basis_strength_unit = "mcg/hr")
Run the code above in your browser using DataLab