【发布时间】:2020-12-26 09:03:51
【问题描述】:
如果数据存在,那么仅以闪亮的方式呈现数据表的最佳方法是什么?现在,我收到以下错误,因为我告诉 shiny 渲染数据表,即使它是 NULL。
Warning in file(file, "rt") :
cannot open file '\': No such file or directory
Warning: Error in file: cannot open the connection
我的代码是这样拆分的,一旦用户选择了 csv 文件,我就会在其中读取数据。用户选择 csv 文件后,错误消失,一切正常。如何告诉 Shiny 在选择有效文件之前不要显示数据表?
filedata <- reactive({
if (is.null(input$file_selector)){
# User has not uploaded a file yet
return(NULL)
} else {
read.csv(paste0(parseDirPath(c(home = 'C:\\Users\\Ruben'), file_dir()),'\\',input$file_selector),skip=1)}
})
output$filetable <- renderDataTable({
filedata()
})
我尝试将 output$filetable
【问题讨论】: