setKeptColumns: Column visibility

View source: R/scatterPlotMatrix.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() && require(shiny)) {
   library(shiny)
   library(scatterPlotMatrix)

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

   server <- function(input, output, session) {
     output$spMatrix <- renderScatterPlotMatrix({
       scatterPlotMatrix(iris)
     })
     observeEvent(input$hideColumnsCB, {
       keptColumns <- vapply(
         1:ncol(iris),
         function(i) {
           return(ifelse(input$hideColumnsCB, ncol(iris) - i >= 2, TRUE))
         },
         logical(1)
       )
       scatterPlotMatrix::setKeptColumns("spMatrix", keptColumns)
     })
   }

   shinyApp(ui, server)
 }


scatterPlotMatrix documentation built on June 22, 2024, 10:50 a.m.