dose_records_builder {ruminate} | R Documentation |
Builds Dose Records Dataframe
Description
Takes information about columns in dataset and constructs the dosing records.
Usage
dose_records_builder(
NCA_DS = NULL,
dose_from = NULL,
col_id = NULL,
col_time = NULL,
col_ntime = NULL,
col_route = NULL,
col_dose = NULL,
col_cycle = NULL,
col_dur = NULL,
col_evid = NULL,
col_analyte = NULL,
col_group = NULL
)
Arguments
NCA_DS |
Dataset containing dosing records. |
dose_from |
Method of dose extraction either "cols" or "rows". |
col_id |
Name of column with subject ID. |
col_time |
Name of column with time since first dose. |
col_ntime |
Name of column with time since the last dose (required with |
col_route |
Name of column with route information. |
col_dose |
Name of column with last dose given. |
col_cycle |
Name of column with dose cycle (required with |
col_dur |
Name of column with dose duration. |
col_evid |
Name of column with event ID (required with |
col_analyte |
Name of column with analyte (optional). |
col_group |
Names of columns with grouping information (optionl). |
Value
list containing the following elements
isgood: Return status of the function.
msgs: Messages to be passed back to the user.
dose_rec:
Examples
if(system.file(package="readxl") !=""){
library(dplyr)
library(readxl)
library(stringr)
# Example data file:
data_file = system.file(package="formods","test_data","TEST_DATA.xlsx")
# Dataset formatted to extract dosing from columns
DS_cols = readxl::read_excel(path=data_file, sheet="DATA") |>
dplyr::filter(EVID == 0) |>
dplyr::filter(DOSE %in% c(3)) |>
dplyr::filter(str_detect(string=Cohort, "^MD")) |>
dplyr::filter(CMT == "C_ng_ml")
drb_res = dose_records_builder(
NCA_DS = DS_cols,
dose_from = "cols",
col_id = "ID",
col_time = "TIME_DY",
col_ntime = "NTIME_DY",
col_route = "ROUTE",
col_cycle = "DOSE_NUM",
col_dose = "DOSE",
col_group = "Cohort")
utils::head(drb_res$dose_rec)
# Dataset formatted to extract dosing from rows (records)
DS_rows = readxl::read_excel(path=data_file, sheet="DATA") |>
dplyr::filter(DOSE %in% c(3)) |>
dplyr::filter(str_detect(string=Cohort, "^MD")) |>
dplyr::filter(CMT %in% c("Ac", "C_ng_ml"))
drb_res = dose_records_builder(
NCA_DS = DS_rows,
dose_from = "rows",
col_id = "ID",
col_time = "TIME_DY",
col_ntime = "NTIME_DY",
col_route = "ROUTE",
col_dose = "AMT",
col_evid = "EVID",
col_group = "Cohort")
utils::head(drb_res$dose_rec)
}