setKeptColumns: Column visibility

View source: R/parallelPlot.R

setKeptColumnsR 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()) {
   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)
 }


parallelPlot documentation built on April 12, 2022, 9:06 a.m.