Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

genShinyApp.template

Generate an example (template) of a dosing regimen shiny app


Description

Create a complete shiny application for exploring dosing regimens given a (hardcoded) PK/PD model.

Usage

genShinyApp.template(
  appDir = "shinyExample",
  verbose = TRUE,
  ODE.config = list(ode = "model", params = c(KA = 0.294), inits = c(eff = 1), method =
    "lsoda", atol = 1e-08, rtol = 1e-06)
)

write.template.server(appDir)

write.template.ui(appDir, statevars)

Arguments

appDir

a string with a directory where to store the shiny app, by default is "shinyExample". The directory appDir will be created if it does not exist.

verbose

logical specifying whether to write messages as the shiny app is generated. Defaults to TRUE.

ODE.config

model name compiled and list of parameters sent to rxSolve().

statevars

List of statevars passed to to the write.template.ui() function. This usually isn't called directly.

A PK/PD model is defined using RxODE(), and a set of parameters and initial values are defined. Then the appropriate R scripts for the shiny's user interface ui.R and the server logic server.R are created in the directory appDir.

The function evaluates the following PK/PD model by default:

    C2 = centr/V2;
    C3 = peri/V3;
    d/dt(depot) =-KA*depot;
    d/dt(centr) = KA*depot - CL*C2 - Q*C2 + Q*C3;
    d/dt(peri)  =                    Q*C2 - Q*C3;
    d/dt(eff)  = Kin - Kout*(1-C2/(EC50+C2))*eff;

This can be changed by the ODE.config parameter.

To launch the shiny app, simply issue the runApp(appDir) R command.

Value

None, these functions are used for their side effects.

Note

These functions create a simple, but working example of a dosing regimen simulation web application. Users may want to modify the code to experiment creating shiny applications for their specific RxODE models.

See Also

Examples

# create the shiny app example (template)
genShinyApp.template(appDir = "myapp")
# run the shiny app
library(shiny)
# runApp("myapp") # Won't launch in environments without browsers
unlink("myapp", recursive=TRUE, force=TRUE) # remove myapp

RxODE

Facilities for Simulating from ODE-Based Models

v1.0.9
GPL (>= 3)
Authors
Matthew L. Fidler [aut] (<https://orcid.org/0000-0001-8538-6691>), Melissa Hallow [aut], Wenping Wang [aut, cre], Zufar Mulyukov [ctb], Alan Hindmarsh [ctb], Awad H. Al-Mohy [ctb], Matt Dowle [ctb], Cleve Moler [ctb], David Cooley [ctb], Drew Schmidt [ctb], Arun Srinivasan [ctb], Ernst Hairer [ctb], Gerhard Wanner [ctb], Goro Fuji [ctb], Hadley Wickham [ctb], Jack Dongarra [ctb], Linda Petzold [ctb], Martin Maechler [ctb], Matteo Fasiolo [ctb], Morwenn [ctb], Nicholas J. Higham [ctb], Roger B. Sidje [ctb], Simon Frost [ctb], Kevin Ushey [ctb], Yu Feng [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.