if(interactive() && require(shiny)) {
library(shiny)
library(parallelPlot)
ui <- fluidPage(
selectInput(
"categoriesRepSelect",
"Categories Representation:",
choices = list(
"EquallySpacedLines" = "EquallySpacedLines",
"EquallySizedBoxes" = "EquallySizedBoxes"
),
selected = "EquallySpacedLines"
),
p("The selector controls the height assigned to each category"),
parallelPlotOutput("parPlot")
)
server <- function(input, output, session) {
output$parPlot <- renderParallelPlot({
categorical <-
list(cyl = c(4, 6, 8), vs = c(0, 1), am = c(0, 1), gear = 3:5, carb = 1:8)
parallelPlot(mtcars, categorical = categorical, refColumnDim = "cyl")
})
observeEvent(input$categoriesRepSelect, {
parallelPlot::setCategoriesRep("parPlot", input$categoriesRepSelect)
})
}
shinyApp(ui, server)
}
Run the code above in your browser using DataLab