# 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 = teal.picks::picks(
teal.picks::datasets("mtcars"),
teal.picks::variables(
choices = c("cyl", "gear"),
selected = "cyl",
multiple = FALSE,
fixed = FALSE
),
teal.picks::values()
),
x = teal.picks::picks(
datasets("mtcars"),
teal.picks::variables(
choices = c("vs", "am"),
selected = "vs",
multiple = FALSE,
fixed = FALSE
),
teal.picks::values()
)
)
)
)
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 = teal.picks::picks(
datasets("ADSL"),
teal.picks::variables(
choices = c("BMRKR2", "COUNTRY"),
selected = "BMRKR2"
),
teal.picks::values()
),
x = teal.picks::picks(
datasets("ADSL"),
teal.picks::variables(
choices = c("SEX", "RACE"),
selected = "RACE"
),
teal.picks::values()
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
Run the code above in your browser using DataLab