if(interactive() && require(shiny)) {
library(shiny)
library(scatterPlotMatrix)
ui <- fluidPage(
selectInput(
"distribType",
"Distribution Representation:",
choices = list("Histogram" = 2, "Density Plot" = 1),
selected = 2
),
p("The selector controls type of representation to use for distribution plots"),
scatterPlotMatrixOutput("spMatrix")
)
server <- function(input, output, session) {
output$spMatrix <- renderScatterPlotMatrix({
scatterPlotMatrix(iris)
})
observeEvent(input$distribType, {
scatterPlotMatrix::setDistribType("spMatrix", input$distribType)
})
}
shinyApp(ui, server)
}
Run the code above in your browser using DataLab