library(knitr)
knitr::opts_chunk$set(fig.width=8, fig.height=4, dev = 'png', dpi = 150, 
                      fig.path='assets/figures/', echo=TRUE, warning=FALSE, message=FALSE, 
                      results = 'asis')

busulfansim R package: r packageDescription('busulfansim', fields = 'Title')

CRAN downloads CRAN_Status_Badge

r packageDescription('busulfansim', fields = 'Description')

Installation

install.pacakges("devtools")
devtools::install_github("asancpt/busulfansim")

# Simply create single dose dataset
busulfansim::bsfnPkparam(Weight = 20, Dose = 200, N = 20) 

# Simply create multiple dose dataset
busulfansim::bsfnPkparamMulti(Weight = 20, Dose = 200, N = 20, Tau = 12) 

Single dose

Create a PK dataset for busulfan single dose

library(busulfansim)
MyDataset <- bsfnPkparam(Weight = 20, Dose = 200, N = 20)
knitr::kable(head(MyDataset), format = 'markdown')

Create a dataset for concentration-time curve

MyConcTime <- bsfnConcTime(Weight = 20, Dose = 200, N = 20)
knitr::kable(head(MyConcTime), format = 'markdown') 

Create a concentration-time curve

bsfnPlot(MyConcTime)

Create plots for publication (according to the amount of busulfan)

#install.packages("cowplot") # if you don't have it
library(cowplot)

MyPlotPub <- lapply(
  c(seq(100, 800, by = 100)), 
  function(x) bsfnPlotMulti(bsfnConcTime(20, x, 20)) + 
    theme(legend.position="none") + 
    labs(title = paste0("Single Dose ", x, "mg")))

plot_grid(MyPlotPub[[1]], MyPlotPub[[2]],
          MyPlotPub[[3]], MyPlotPub[[4]],
          MyPlotPub[[5]], MyPlotPub[[6]],
          MyPlotPub[[7]], MyPlotPub[[8]],
          labels=LETTERS[1:8], ncol = 2, nrow = 4)

Multiple dose

Create a PK dataset for busulfan multiple doses

MyDatasetMulti <- bsfnPkparamMulti(Weight = 20, Dose = 200, N = 20, Tau = 12)
knitr::kable(head(MyDatasetMulti), format = 'markdown') 

Create a dataset for concentration-time curve

MyConcTimeMulti <- bsfnConcTimeMulti(Weight = 20, Dose = 200, N = 20, Tau = 12, Repeat = 10)
knitr::kable(head(MyConcTimeMulti), format = 'markdown')

Create a concentration-time curve

bsfnPlotMulti(MyConcTimeMulti)

Create plots for publication (according to dosing interval)

#install.packages("cowplot") # if you don't have it
library(cowplot)

MyPlotMultiPub <- lapply(
  c(seq(4, 32, by = 4)), 
  function(x) bsfnPlotMulti(bsfnConcTimeMulti(20, 250, 20, x, 15)) + 
    theme(legend.position="none") + 
    labs(title = paste0("q", x, "hr" )))

plot_grid(MyPlotMultiPub[[1]], MyPlotMultiPub[[2]],
          MyPlotMultiPub[[3]], MyPlotMultiPub[[4]],
          MyPlotMultiPub[[5]], MyPlotMultiPub[[6]],
          MyPlotMultiPub[[7]], MyPlotMultiPub[[8]],
          labels=LETTERS[1:8], ncol = 2, nrow = 4)

Interactive shiny app

bsfnShiny()


asancpt/busulfansim documentation built on May 31, 2019, 8:40 a.m.