rhandsontable函数产生错误

时间:2019-07-12 02:38:52

标签: shiny rhandsontable

您好,我收到以下错误:

错误:无法将类型'closure'强制转换为类型为'character'的向量

嘿,我是新手,无法弄清为什么会发生这种情况

library(shinydashboard)
library(shiny)
library(data.table)
library(rhandsontable)

ui = dashboardPage(
  dashboardHeader(title = "rhandsontable Example"),
  dashboardSidebar(
    sidebarMenu(
      menuItem("Table", tabName = "table", icon = icon("dashboard"))
    )
  ),
  dashboardBody(
    tabItems(
      tabItem(tabName = "table",
              fluidRow(box(rHandsontableOutput("hot", height = 400)),
                       box(rHandsontableOutput("hot2", width = 200))),
              fluidRow(box(rHandsontableOutput("hot3")))
      )
    )
  )
)

server = function(input, output) {
  output$hot = renderRHandsontable({
    rhandsontable(do.call(cbind, lapply(1:20, function(i) data.table(rnorm(10000)))))
  })

  output$hot2 = renderRHandsontable({
    rhandsontable(do.call(cbind, lapply(1:3, function(i) data.table(rnorm(5)))))
  })

  output$hot3 = renderRHandsontable({
    rhandsontable(do.call(cbind, lapply(1:3, function(i) data.table(rnorm(5)))),
                  stretchH = "all")
  })
}

shinyApp(ui, server)

我认为这会起作用

0 个答案:

没有答案