[英]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.