繁体   English   中英

无法在闪亮的 flexdashboard 中显示可变数据类型

[英]failed to display variable data types in shiny flexdashboard

我正在尝试动态显示变量类型,我的代码是这样的(使用到 flexdashboard 闪亮的应用程序中):

tblCls <- reactive({
    req(input$file1)
    inFile <- input$file1
    if (is.null(inFile)){
      return(NULL)
    }else{
     datatable(head(read.csv(inFile$datapath, header = input$header), 5))

    }
})

output$class <- renderText({
    print(class( tblCls()  ))
  })

textOutput("class")

我从 fileInput 方法读取了 csv 文件。

结果是我们在 R 中执行str(DF)时得到的结果,但我得到的是数据表datatables htmlwidget作为输出。

不确定我在这里做错了什么,需要了解正确的方法。

这是你需要的——

tblCls <- reactive({
   req(input$file1) # if else not needed when using req()
   head(read.csv(input$file1$datapath, header = input$header), 5)
})

output$class <- renderPrint({
   str(tblCls())
})

textOutput("class")

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM