Learn R Programming

vigicaen (version 1.0.0)

add_dose: Add drug dose column(s) to a dataset, in milligram per day

Description

[Experimental] add_dose() creates drug dose columns in vigibase datasets (demo, link, adr, drug, ind) for specified drugs in a dataset. It calculates daily dose values based on dose amount, frequency, and their corresponding units. The function is compatible with demo, link, adr, drug and ind datasets.

Usage

add_dose(
  .data,
  d_code,
  d_dose_names = names(d_code),
  repbasis = "sci",
  method = c("DrecNo", "MedicinalProd_Id"),
  drug_data,
  verbose = TRUE
)

Arguments

.data

The dataset used to identify individual reports (usually, it is demo)

d_code

A named list of drug codes (DrecNos or MPI). See Details.

d_dose_names

A character vector. Names for drug dose columns (must be the same length as d_code), default to names(d_code). Will be followed by a fixed suffix "_dose_mg_per_day".

repbasis

Suspect, interacting and/or concomitant. Type initial of those you wish to select ("s" for suspect, "c" for concomitant and "i" for interacting ; default to all, e.g. "sci").

method

A character string. The type of drug code (DrecNo or MedicinalProd_Id). See details.

drug_data

A data.frame containing the drug data (usually, it is drug)

verbose

Logical, whether to display messages about added doses.

Details

Actual supported dosage regimens are any combination of:

  • Kilograms, grams, milligrams, micrograms, nanograms, or picograms

  • Per minute, hour, day, week, month, or year.

Note that the result will be expressed in milligrams per day, whatever the aforementioned combination is. This may lead to very small or very large amounts in drug_dose_mg_per_day columns, depending on the actual dosage regimen. The function identifies drug doses in a dataset by cross-referencing with a drug_data table. If either the amount unit (grams, etc.) or the frequency (days, etc.) is missing in drug_data, the corresponding row will be omitted. Drugs may be filtered based on reputation bases (suspect, concomitant, or interacting). Either drug record numbers (e.g., from get_drecno()), or medicinalprod_ids (e.g., from get_atc_code()) can be used to identify drugs. Default method is to DrecNos.

It is very important to check the results, as coding issues are common for dose data, and some results may seem unreliable.

See Also

add_drug(), get_drecno(), get_atc_code()

Examples

Run this code
# Example: Adding doses for paracetamol
d_code <- list(paracetamol = c(97818920, 97409107))
demo <-
  add_dose(
    .data = demo_,
    d_code = d_code,
    d_dose_names = "paracetamol",
    drug_data = drug_
    )

desc_cont(demo, "paracetamol_dose_mg_per_day")

# Use only drug dose where paracetamol had a "suspect" reputation base.
demo <-
  add_dose(
    .data = demo_,
    d_code = d_code,
    d_dose_names = "para_susp",
    repbasis = "s",
    drug_data = drug_
  )

desc_cont(demo, "para_susp_dose_mg_per_day")

Run the code above in your browser using DataLab