Dynamic adjust of number of rows

I am trying to create a table with a certain number of rows that the user define, the user might change at any time this number. I have tried many different times to do that, which should be a simple task, but with no success. On my last try I keep receiving the following error message:
Error in makeFunction(body = expr, env = env) :
argument "expr" is missing, with no default

Here is my code, if anyone can give me any insight of what am I doing wrong I would appreciate!

Thanks

ui <- shinyUI(fluidPage(
  tabPanel("Well data",
           titlePanel("Enter well basic data information"),
           mainPanel(
             fluidRow(
               column(6,
                      numericInput(inputId = "NumberFlowZones",
                                   label = "Number of flow zones",
                                   value = 3,
                                   width = "200px")
               )
             ),
               fluidRow(
               column(12,
                        hotable("InterpFlowZones"),hotable("SimulFlowZones"))
)))))
server<- function(input,output,session){
    
  A = data.frame(matrix(ncol=6, nrow=observeEvent(input$NumberFlowZones))) # init - input matrix A
  output$InterpFlowZones <- renderHotable({data.frame(A)}, readOnly = FALSE)

   R = data.frame(matrix(ncol=7, nrow=observeEvent(input$NumberFlowZones)))
   output$SimulFlowZones <- renderHotable({data.frame(R)}, readOnly = TRUE)

  }

shinyApp(ui, server)

Solved already, if anyone need something similar here is a code I found:

Chunck of code obtained from: https://stackoverflow.com/questions/22272571/data-input-via-shinytable-in-r-shiny-application

A = data.frame(matrix(vector(mode = 'numeric',length = 6), 
nrow = 3, ncol = 6)) # init - input matrix A
output$InterpFlowZones <- renderHotable({data.frame(A)}, readOnly = FALSE)
  
R = data.frame(matrix(vector(mode = 'numeric',length = 7), 
nrow = 2, ncol = 7)) # init - result matrix R
output$SimulFlowZones <- renderHotable({data.frame(R)}, 
readOnly = TRUE)
  
observe({  # process matrix
  df <- hot.to.df(input$InterpFlowZones)
  if(!is.null(df)) {    # ensure data frame from table exists
  B = data.matrix(df) # ensure its numeric
  R = B^2             # some matrix operation
  output$SimulFlowZones <- renderHotable({data.frame(R)})
  }
}) # end of observe

If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.