shinymlx | R Documentation |
Creates a Shiny application for longitudinal data model
shinymlx(
model,
parameter = NULL,
output = NULL,
treatment = NULL,
regressor = NULL,
group = NULL,
data = NULL,
appname,
style = "basic",
settings = NULL,
title = " "
)
model |
a |
parameter |
a vector, or a list of shiny widgets |
output |
a list - or a list of lists - with fields:
|
treatment |
a list with fields
Input argument of Simulx can also be used, i.e. a list with fields |
regressor |
a list, or a list of lists, with fields
|
group |
a list, or a list of lists, with fields:
|
data |
a datafile to display with the plot |
appname |
the name of the application (and possibly its path) |
style |
the style of the Shiny app
|
settings |
a list of settings
|
title |
the title of the application |
shinymlx automatically generates files ui.R and server.R required for a Shiny application.
Elements of parameters
and treatment
can be either scalars or lists.
A scalar automatically generates a slider with default minimum and maximum values and default step.
A list may contain the type of widget ("slider", "select", "numeric") and the settings defining the widget:
(value, min, max, step) for slider
, (selected, choices) for select
and
value for numeric
.
See http://simulx.webpopix.org/mlxr/shinymlx/ for more details.
A Shiny app with files ui.R, server.R and model.txt
## Not run:
PKPDmodel <- inlineModel("
[LONGITUDINAL]
input={ka,V,Cl,Imax,IC50,S0,kout}
EQUATION:
C = pkmodel(ka, V, Cl)
E_0 = S0
ddt_E = kout*((1-Imax*C/(C+IC50))*S0- E)
")
p1 <- c(ka=0.5, V=10, Cl=1)
p2 <- c(Imax=0.5, IC50=0.03, S0=100, kout=0.1)
adm <- list(tfd=5, nd=15, ii=12, amount=1)
f1 <- list(name = 'C', time = seq(0, 250, by=1))
f2 <- list(name = 'E', time = seq(0, 250, by=1))
f <- list(f1, f2)
shinymlx(model=PKPDmodel, treatment=adm, parameter=list(p1,p2), output=f,
style="dashboard1", appname=tempdir())
#------------------------------------------------------------------------
p1 <- list(
ka = list(widget="slider", value=0.5, min=0.1, max=2, step=0.1),
V = list(widget="slider", value=10, min=2, max=20, step=2),
Cl = list(widget="slider", value=1, min=0.1, max=2, step=0.1)
)
adm <- list(
tfd = list(widget="slider", value=5, min=0, max=100, step=5),
nd = list(widget="numeric", value=15),
ii = list(widget="select", selected=12, choices=c(3,6,12,18,24)),
amount = list(widget="slider", value=40, min=0, max=50, step=5)
)
s <- list(select.x=FALSE, select.y=FALSE)
shinymlx(model=PKPDmodel, treatment=adm, parameter=list(p1,p2), output=f,
style="navbar1", settings=s, appname=tempdir())
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.