setRefColumnDim {parallelPlot}R Documentation

Line coloring

Description

Tells which column is used to determine the color to attribute to each row.

Usage

setRefColumnDim(id, dim)

Arguments

id

output variable to read from (id which references the requested plot)

dim

Name of the reference column (used to determine the color to attribute to a row); NULL is allowed, meaning there is no coloring to apply.

Value

No return value, called from shiny applications for side effects.

Examples

 if(interactive() && require(shiny)) {
   library(shiny)
   library(parallelPlot)

   ui <- fluidPage(
     selectInput(
       "refColumnDimSelect",
       "Reference column:",
       choices = list(
         "None" = 1, "First" = 2, "Second" = 3
       ),
       selected = "None"
     ),
     p("Selector controls the colomn used to determine the color to attribute to rows"),
     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)
     })
     observeEvent(input$refColumnDimSelect, {
       choice <- as.numeric(input$refColumnDimSelect)
       refColumnDim <- list(NULL, colnames(mtcars)[1], colnames(mtcars)[2])[[choice]]
       parallelPlot::setRefColumnDim("parPlot", refColumnDim)
     })
   }

   shinyApp(ui, server)
 }


[Package parallelPlot version 0.4.0 Index]