[英]failed to display variable data types in shiny flexdashboard
I am trying to display variable types dynamically and my code is something like this (using into flexdashboard shiny app):我正在尝试动态显示变量类型,我的代码是这样的(使用到 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")
I read the csv file from fileInput method.我从 fileInput 方法读取了 csv 文件。
The result is expected something what we get when do str(DF)
in R but what I am getting is datatables htmlwidget
as output.结果是我们在 R 中执行
str(DF)
时得到的结果,但我得到的是数据表datatables htmlwidget
作为输出。
Not sure what I have done wrong here, need to understand the correct method.不确定我在这里做错了什么,需要了解正确的方法。
Here's what you need -这是你需要的——
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.