adpc_a <- adpc %>%
filter(
PARAM == "Plasma Drug X",
ARMCD == "ARM A"
) %>%
mutate(Patient_ID = sub(".*id-", "", USUBJID)) %>%
mutate(avalog = ifelse(AVAL != 0, AVAL, 0.001)) %>%
filter(Patient_ID %in% unique(Patient_ID)[1:10])
use_title3 <- "Log-scale Plot of X Concentration (ug/mL) Over Time by Treatment: \nPK Evaluable Patients"
use_subtitle3 <- "Analyte: Plasma X (ug/mL) \nTreatment Group: ARM A"
use_footnote3 <- "Program: \nOutput:"
result <- g_ipp(
df = adpc_a,
xvar = "NFRLT",
yvar = "avalog",
xlab = "Norminal Time from First Dose (hr)",
ylab = "Concentration (ug/mL)",
id_var = "Patient_ID",
add_baseline_hline = FALSE,
yvar_baseline = "AVAL",
title = use_title3,
caption = use_footnote3,
subtitle = use_subtitle3,
plotting_choices = "all_in_one"
)
plot <- result + ggplot2::scale_y_log10(breaks = c(0.001, 0.01, 0.1, 1, 10), labels = c(0.001, 0.01, 0.1, 1, 10))
plot