# Example I: Single subject oral data
df <- data.frame(
time = c(0.25, 0.5, 1, 2, 4, 6, 8, 12),
concentration = c(5.1, 9.8, 14.2, 13.5, 10.2, 6.8, 4.5, 2.1)
)
one_compartment_oral(
data = df,
time_col = "time",
conc_col = "concentration",
dose = 100
)
# Example II: Condition-dependent kinetics
df_cond <- data.frame(
time = rep(c(0.25, 0.5, 1, 2, 4, 6, 8), 2),
concentration = c(
4.8, 9.5, 13.7, 12.8, 9.2, 6.4, 3.9, # Condition A
5.2, 10.1, 14.0, 12.5, 8.7, 5.8, 3.5 # Condition B
),
condition = rep(c("Condition A", "Condition B"), each = 7)
)
one_compartment_oral(
data = df_cond,
time_col = "time",
conc_col = "concentration",
dose = 100,
group_col = "condition"
)
# Example III: Multiple subjects
df_subjects <- data.frame(
time = rep(c(0.25, 0.5, 1, 2, 4, 6, 8), 10),
concentration = c(
5.0, 9.7, 14.0, 13.2, 10.0, 6.6, 4.2, # Subject 1
4.9, 9.5, 13.8, 12.9, 9.5, 6.3, 4.0, # Subject 2
5.1, 9.9, 14.1, 13.5, 10.3, 6.9, 4.3, # Subject 3
4.8, 9.6, 13.9, 13.1, 9.8, 6.5, 4.1, # Subject 4
5.2, 10.0, 14.3, 13.6, 10.5, 7.1, 4.4, # Subject 5
5.1, 9.8, 14.0, 13.3, 10.1, 6.7, 4.3, # Subject 6
4.9, 9.6, 13.7, 12.8, 9.4, 6.2, 3.9, # Subject 7
5.0, 9.9, 14.2, 13.4, 10.2, 6.8, 4.1, # Subject 8
5.2, 10.1, 14.5, 13.7, 10.7, 7.2, 4.5, # Subject 9
4.8, 9.5, 13.6, 12.7, 9.1, 6.0, 3.8 # Subject 10
),
subject = rep(paste0("S", 1:10), each = 7)
)
one_compartment_oral(
data = df_subjects,
time_col = "time",
conc_col = "concentration",
dose = 100,
group_col = "subject"
)
Run the code above in your browser using DataLab