Learn R Programming

parallelPlot (version 0.4.0)

changeRow: Row edition

Description

Asks to change a row.

Usage

changeRow(id, rowIndex, newValues)

Value

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

Arguments

id

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

rowIndex

index of the changed row.

newValues

list of new values to attribute to the row (list associating a value to a column identifier).

Examples

Run this code
 if(interactive() && require(shiny)) {
   library(shiny)
   library(parallelPlot)

   ui <- fluidPage(
     sliderInput(
       "rowValueSlider",
       "Value for 'Sepal.Length' of first row:",
       min = 4, max = 8, step = 0.1,
       value = iris[["Sepal.Length"]][1]
     ),
     p("Slider controls the new value to assign to 'Sepal.Length' of the first row"),
     parallelPlotOutput("parPlot")
   )

   server <- function(input, output, session) {
     output$parPlot <- renderParallelPlot({
       parallelPlot(iris)
     })
     observeEvent(input$rowValueSlider, {
       newValues <- iris[1,]
       newValues[["Sepal.Length"]] <- input$rowValueSlider
       parallelPlot::changeRow("parPlot", 1, newValues)
     })
   }

   shinyApp(ui, server)
 }

Run the code above in your browser using DataLab