PKPG04
Box Plot of Pharmacokinetic Parameters by Visit – Plasma
Code
# filtered parameter
adpp <- adpp %>% filter(toupper(PARAMCD) == "CMAX" & toupper(PPSPEC) == "PLASMA")
use_title <- paste0("Boxplot of ", as.character(unique(adpp$PARAM)), " by Visit")
use_subtitle <- paste0(
"Analyte:\nPK Parameter: ",
as.character(unique(adpp$PARAM)),
" (",
as.character(unique(adpp$AVALU)),
")"
)
use_footnote <- "Program: \nOutput:"
p <- ggplot(adpp, aes(x = AVISIT, y = AVAL, fill = ACTARM)) +
geom_boxplot(outlier.size = 2) +
stat_boxplot(geom = "errorbar") +
stat_summary(geom = "point", fun = "mean", col = "black", size = 5, shape = 8, position = position_dodge(0.75)) +
geom_text_repel(
data = . %>% dplyr::group_by(AVISIT, ACTARM) %>% dplyr::filter(AVAL %in% boxplot.stats(AVAL)$out),
aes(x = AVISIT, y = AVAL, label = SUBJID, color = ACTARM),
size = 3, hjust = -0.2, position = position_dodge(0.75)
) +
labs(
title = use_title,
subtitle = use_subtitle,
caption = use_footnote,
x = "Visit",
y = paste0(as.character(unique(adpp$PARAM)), " (", as.character(unique(adpp$AVALU)), ")")
) +
theme(plot.caption = element_text(hjust = 0)) +
theme_nest()
plot <- p + geom_point(aes(fill = ACTARM), size = 2, shape = 21, position = position_dodge(0.75))
plot
Timestamp
Session Info
R version 4.4.0 (2024-04-24)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 22.04.4 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0
locale:
[1] C
time zone: Etc/UTC
tzcode source: system (glibc)
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] nestcolor_0.1.2 ggrepel_0.9.5 ggplot2_3.5.1 dplyr_1.1.4
[5] scda.2022_0.1.5 scda_0.1.6 tern_0.9.4 rtables_0.6.7
[9] magrittr_2.0.3 formatters_0.5.6
loaded via a namespace (and not attached):
[1] utf8_1.2.4 generics_0.1.3 tidyr_1.3.1 lattice_0.22-6
[5] digest_0.6.35 evaluate_0.23 grid_4.4.0 fastmap_1.1.1
[9] jsonlite_1.8.8 Matrix_1.7-0 backports_1.4.1 brio_1.1.5
[13] survival_3.6-4 purrr_1.0.2 fansi_1.0.6 scales_1.3.0
[17] codetools_0.2-20 Rdpack_2.6 cli_3.6.2 rlang_1.1.3
[21] rbibutils_2.2.16 munsell_0.5.1 splines_4.4.0 withr_3.0.0
[25] yaml_2.3.8 tools_4.4.0 checkmate_2.3.1 colorspace_2.1-0
[29] broom_1.0.5 vctrs_0.6.5 R6_2.5.1 lifecycle_1.0.4
[33] htmlwidgets_1.6.4 pkgconfig_2.0.3 pillar_1.9.0 gtable_0.3.5
[37] glue_1.7.0 Rcpp_1.0.12 xfun_0.43 tibble_3.2.1
[41] tidyselect_1.2.1 knitr_1.46 farver_2.1.1 htmltools_0.5.8.1
[45] rmarkdown_2.26 labeling_0.4.3 testthat_3.2.1.1 compiler_4.4.0
.lock
file
Download the .lock
file and use renv::restore()
on it to recreate environment used to generate this website.
Code
parent_file_path <- knitr::current_input(dir = TRUE)
book_root_dir <- parent_file_path
while (!file.exists(file.path(book_root_dir, "_quarto.yml"))) book_root_dir <- dirname(book_root_dir)
lock_path <- file.path(
"../../assets/www/lock",
paste0(
gsub(
file.path(book_root_dir, ""),
"",
gsub(
"\\.rmarkdown$",
"",
knitr::current_input(dir = TRUE)
)
),
".lock"
)
)
withr::with_options(
list(renv.verbose = FALSE),
renv::snapshot(parent_file_path, lockfile = lock_path, prompt = FALSE, force = TRUE)
)