setKeptColumns {parallelPlot}R Documentation

Column visibility

Description

Tells which columns have to be visible.

Usage

setKeptColumns(id, keptColumns)

Arguments

id

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

keptColumns

Vector of boolean (one for each data column), FALSE if column has to be hidden. A named list can also be provided to only indicate which columns must be assigned to a new visibility.

Value

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

Examples

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

   ui <- fluidPage(
     checkboxInput("hideColumnsCB", "Hide last columns", FALSE),
     p("The check box controls the visibility of the two last columns"),
     parallelPlotOutput("parPlot")
   )

   server <- function(input, output, session) {
     output$parPlot <- renderParallelPlot({
       parallelPlot(mtcars)
     })
     observeEvent(input$hideColumnsCB, {
       keptColumns <- vapply(
         1:ncol(mtcars),
         function(i) {
           return(ifelse(input$hideColumnsCB, ncol(mtcars) - i >= 2, TRUE))
         },
         logical(1)
       )
       parallelPlot::setKeptColumns("parPlot", keptColumns)
     })
   }

   shinyApp(ui, server)
 }


[Package parallelPlot version 0.4.0 Index]