# general data example
data <- teal_data()
data <- within(data, {
require(nestcolor)
mtcars <- mtcars
for (v in c("cyl", "vs", "am", "gear")) {
mtcars[[v]] <- as.factor(mtcars[[v]])
}
})
app <- init(
data = data,
modules = modules(
tm_g_response(
label = "Response Plots",
response = data_extract_spec(
dataname = "mtcars",
select = select_spec(
label = "Select variable:",
choices = variable_choices(data[["mtcars"]], c("cyl", "gear")),
selected = "cyl",
multiple = FALSE,
fixed = FALSE
)
),
x = data_extract_spec(
dataname = "mtcars",
select = select_spec(
label = "Select variable:",
choices = variable_choices(data[["mtcars"]], c("vs", "am")),
selected = "vs",
multiple = FALSE,
fixed = FALSE
)
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
# CDISC data example
data <- teal_data()
data <- within(data, {
require(nestcolor)
ADSL <- teal.data::rADSL
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
app <- init(
data = data,
modules = modules(
tm_g_response(
label = "Response Plots",
response = data_extract_spec(
dataname = "ADSL",
select = select_spec(
label = "Select variable:",
choices = variable_choices(data[["ADSL"]], c("BMRKR2", "COUNTRY")),
selected = "BMRKR2",
multiple = FALSE,
fixed = FALSE
)
),
x = data_extract_spec(
dataname = "ADSL",
select = select_spec(
label = "Select variable:",
choices = variable_choices(data[["ADSL"]], c("SEX", "RACE")),
selected = "RACE",
multiple = FALSE,
fixed = FALSE
)
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
Run the code above in your browser using DataLab