format_obs_for_XML: Format generic observed data for making an XML overlay file

View source: R/format_obs_for_XML.R

format_obs_for_XMLR Documentation

Format generic observed data for making an XML overlay file

Description

format_obs_for_XML will convert generic observed concentration-time data into a format that works for pasting into the Simcyp Simulator PE data template, which is then used to generate an observed data overlay XML file. This should be used with one study cohort at at time, e.g., only one dose level and one dosing regimen.

Usage

format_obs_for_XML(
  obs_dataframe,
  subject_column,
  DVID_column,
  time_column,
  conc_column,
  conc_sd_column,
  dose = 100,
  dose_unit = "mg",
  inf_duration = NA,
  dosing_start_time = 0,
  set_t0_concs_to_0 = TRUE,
  missing_value_treatment = "as is",
  dose_route = "Oral",
  dose_interval = NA,
  num_doses = NA,
  end_time = NA,
  custom_dosing_schedule = NA,
  simulator_version = 22,
  compoundID = "Substrate",
  demog_dataframe,
  age_column,
  weight_column,
  height_column,
  sex_column,
  save_output = NA,
  return_data = FALSE
)

Arguments

obs_dataframe

observed concentration-time data.frame

subject_column

the column in the observed concentration-time data.frame and in the optional demographic data.frame that contains the subject ID. Note that this means that the subject ID column in the concentration-time data.frame and in the demographic data.frame must match.

DVID_column

the column in the observed concentration-time data.frame that indicates any time the DV number in the PE file should change. It's fine to omit this if everything should be "1". If you haven't already created a column for this with "1", "2", or "3" as the values for the DVID, you can specify which column you want to use and we'll assign the numbers for you. For example, if you have some data in plasma and some in blood and have a column called "Tissue", you'd set this as DVID_column = Tissue, and we'll assign one blood to "1" and plasma to "2" (numbers are automatically assigned alphabetically). If you have an inhibitor present in some cases but not others, set this to the column with the inhibitor data, and any time the value changes in obs_dataframe, the number in the "DV" column will change in the output. We'll include a message to indicate which value in the original data was used for which DV number.

time_column

the column in the observed concentration-time data.frame that contains time data

conc_column

the column in the observed concentration-time data.frame that contains concentration data

conc_sd_column

the column in the observed concentration-time data.frame that contains the standard deviation of the concentration (optional). This will be mapped to the column "SD SE" in the PE data template file. This only applies for Simcyp Simulator versions >= 22 and also obviously only applies if you have reported mean concentrations for the dependent variable.

dose

the amount of the dose. If this amount varies, please include one dose amount for each time. For example: dose = c(100, 50, 50) will generate doses of 100 mg for the first dose and then 50 mg for the next two doses. An R coding tip: You don't have to list everything multiple times; you can use the function rep to repeat elements. For example, here's how you could specify that the 1st dose should be 100 mg but the next 10 doses should be 50: dose = c(100, rep(50, 10))

dose_unit

the unit of dosing. Options are "mg" (default), "mg/m2", or "mg/kg".

inf_duration

the infusion duration (min) (optional)

dosing_start_time

the start time of compound administration (h); default is 0.

set_t0_concs_to_0

TRUE (default) or FALSE for whether to set any concentrations at t0 for the 1st dose to 0.

missing_value_treatment

How should missing values be dealt with? The Simcyp PE template will not allow any missing values for concentrations, so they will be removed from the data automatically. Options for dealing with missing values:

"as is" (default)

leaves all data as is. Missing values will be removed.

"impute X" where X is a number

Missing values will be replaced with X.

If you set set_t0_concs_to_0 = TRUE, that overrides any options selected here, but only for t0 concentrations.

dose_route

the route of administration. Options are "Oral" (default), "Intravenous", "Dermal", "Inhaled", "SC-First Order", "SC-Mechanistic", or "Auto-detect". Not case sensitive.

dose_interval

the dosing interval in hours. Default is NA for a single dose. Set this to, e.g., 24 for a QD dosing regimen.

num_doses

the number of doses to generate. If this is left as NA and you have specified the dose interval, then the value for end_time will be used to determine the number of doses administered. If this is NA and so is dose_interval, we'll assume you want a single dose.

end_time

the end time of the study in hours. If num_doses is filled out, that value will be used preferentially. If num_doses, end_time, and custom_dosing_schedule are all NA, we'll use the maximum time in the data as the end time.

custom_dosing_schedule

a custom dosing schedule to be used for each subject in hours, e.g., custom_dosing_schedule = c(0, 12, 24, 168, 180, 192); if this is filled out, values in dose_interval, num_doses, and end_time will all be ignored.

simulator_version

the version of the simulator that will be used. This affects what columns will be included in the output.

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 dose_route, dose_unit, and dose or list just one of each with the understanding that they will all be the same.

demog_dataframe

a data.frame of demographic information (optional)

age_column

the column in demog_dataframe that contains age data

weight_column

the column in demog_dataframe that contains weight data

height_column

the column in demog_dataframe that contains height data

sex_column

the column in demog_dataframe that contains sex data

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.

return_data

TRUE or FALSE (default) for whether to return a data.frame of the output at the end. If you're only using this to save csv files to convert into XML overlay files, you probably don't need to get that object back here, so that's why this argument exists.

Value

a data.frame

Examples


# None yet


shirewoman2/Consultancy documentation built on Feb. 18, 2025, 10 p.m.