0

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.

Community
  • 1
  • 1
Jian
  • 365
  • 1
  • 6
  • 19
  • I think `rhandsontable` would help you here https://jrowen.github.io/rhandsontable/ – Pork Chop Aug 31 '17 at 13:03
  • I will take a look at it. Thanks, Pork. Unfortunately the user doesn't have a csv/table to import. – Jian Aug 31 '17 at 13:19
  • I know, you mentioned that. The package will allow you to create tables on the fly and perform `CRUD` operations. – Pork Chop Aug 31 '17 at 14:32
  • I managed to create input table with rhandsontable, but failed to refer to the cell values in the table. – Jian Aug 31 '17 at 19:17

0 Answers0