View source: R/create_doses_from_file.R
create_doses_from_file | R Documentation |
create_doses_from_file
uses an Excel or csv file with subject
information to generate a data.frame of dosing times and amounts – one for
every subject – based on the dosing regimen specified. WARNING: This doesn't
work when there are spaces in the column names in the study file! (I'm
looking into whether there's a way around that. -LSh) This is meant for
generating XML files for use in Phoenix WNL.Special notes for when
you have more than one value for some items: If you have multiple values for
anything having to do with the compound – the compound ID, administration
route, dose unit, or dose amount (all have the prefix "compound_") – then
all the other arguments having to do with compounds must have that same
number of values or must have only one value, which will be repeated as
needed. Really, this function will just be easier to use if you run it once
for each compound you want. (See the examples at the bottom of the help
file.) Any time you need to specify multiple values, you can make use of the
R function rep
to repeat elements of a vector. (See the R
coding tip for the argument compound_dose_amount
for an example.)
create_doses_from_file(
study_file,
dose_interval = 24,
num_doses = NA,
end_time = NA,
custom_dosing_schedule = NA,
compoundID = "Substrate",
compound_dosing_start_time = 0,
compound_dose_route = "Oral",
compound_dose_unit = "mg",
compound_dose_amount = 100,
compound_inf_duration = NA,
subj_ID_column,
subj_age_column,
subj_weight_column,
subj_height_column,
subj_sex_column,
save_output = NA
)
study_file |
optionally specify a file containing study information. This will be used for determining subject IDs, ages, weights, heights, and sexes for the subjects who will be dosed. |
dose_interval |
the dosing interval in hours. Default is 24 for a QD dosing regimen. |
num_doses |
the number of doses to generate. If this is left as NA, then
the value for |
end_time |
the end time of the dosing in hours. If |
custom_dosing_schedule |
a custom dosing schedule to be used for each
subject in hours, e.g., |
compoundID |
specify the compound that's being dosed. Options are
"Substrate" (default), "Inhibitor 1", "Inhibitor 2", or "Inhibitor 3". Not
case sensitive. If you list more than one compound, you must also list more
than one |
compound_dosing_start_time |
the start time of compound administration (h); default is 0. |
compound_dose_route |
the route of administration. Options are "Oral" (default), "Intravenous", "Dermal", "Inhaled", "SC-First Order", "SC-Mechanistic", or "Auto-detect". Not case sensitive. |
compound_dose_unit |
the unit of dosing. Options are "mg" (default), "mg/m2", or "mg/kg". |
compound_dose_amount |
the amount of the dose. If this amount varies,
please include one dose amount for each time. For example:
|
compound_inf_duration |
the infusion duration (min) (optional) |
subj_ID_column |
the name of the column in |
subj_age_column |
the name of the column in |
subj_weight_column |
the name of the column in |
subj_height_column |
the name of the column in |
subj_sex_column |
the name of the column in |
save_output |
the file name to use for saving the output as a csv; if left as NA, this will generate a data.frame in R but no output will be saved. |
a data.frame
# QD dosing regimen of 100 mg
create_dose_rows_from_file(study_file = "My dose info.csv",
dose_interval = 24, num_doses = 4,
subj_ID_column = Subject)
# If you have multiple compounds -- say you've got a DDI study with both a
# substrate and a perpetrator -- this will probably be easiest to manage if you
# run \code{create_doses_from_file} once for each compound. It just gets pretty
# complicated pretty quickly to have a substrate with one dosing interval,
# start time, and amount and then an inhibitor with a \emph{different} dosing
# interval, start time, and amount. Here's an example of how you could do this
# but still get just one csv file at the end:
# Substrate is dosed one time at 10 mg starting at t = 168 h.
Doses_sub <- create_doses(study_file = "Subject metadata.csv",
subj_ID_column = SubjectID,
subj_age_column = Age,
num_doses = 1, compoundID = "Substrate",
compound_dosing_start_time = 168,
compound_dose_amount = 10)
# Inhibitor is dosed QD at 500 mg for 336 h starting at t = 0 h.
Doses_inhib <- create_doses(study_file = "Subject metadata.csv",
subj_ID_column = SubjectID,
subj_age_column = Age,
dose_interval = 24, end_time = 336,
compoundID = "Inhibitor 1",
compound_dosing_start_time = 0,
compound_dose_amount = 500)
MyDoses <- bind_rows(Doses_sub, Doses_inhib)
write.csv(MyDoses, file = "Dose rows for sub and inhib.csv",
row.names = FALSE)
# Please see more examples with the function "create_doses".
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.