簡體   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