R shiny matrix or table input

1.1k views Asked by At

I want to create a matrix or table as input for user to interact with in Shiny.

For example:

sample name             number of tests
350292                  3
...                     ...

I want to automatically generate tabs in the mainPanel for user to input data for the different samples.

This is possible with matrixInput in the shinyIncubator package, but the matrixInput function does not support column names.

Is there a better way to do this?

Update

I tried the rhandsontable package.

Code:

library(shiny)
library(rhandsontable)

DF <- data.frame(name=c(350292, 360765), run=c(3,2))
colnames(DF) <- c("sample name", "number of tests")

ui <- fluidPage(
  headerPanel("test"),
  mainPanel(rHandsontableOutput("sample"))
)

server <- function(input, output) {
  output$sample <- renderRHandsontable({
    rhandsontable(DF, rowHeaders = NULL) %>%
     hot_col(c("sample name", "number of tests"), format = "0")
  })
}

shinyApp(ui = ui, server = server)

How can I call values using the reactive() and rhandsontable?

I want to create tabs based on sample name and test number.

0

There are 0 answers