2
我想加载一个excel文件并显示摘要。该文件正在加载没有任何错误,但不显示任何内容。在Shiny R App中使用read.xlsx
这里是我的代码
ui.R
library(shiny)
shinyUI(pageWithSidebar(
headerPanel("Analysis"),
sidebarPanel(wellPanel(fileInput('file1', 'Choose XLSX File',
accept=c('sheetName', 'header'), multiple=FALSE))),
mainPanel(
tabsetPanel(
tabPanel("Tab1",h4("Summary"), htmlOutput("summary"))
)))
server.R
library(shiny)
shinyServer(function(input, output) {
dataset = reactive({
infile = input$file1
if (is.null(infile))
return(NULL)
infile_read = read.xlsx(infile$datapath, 1)
return(infile_read)
})
output$summary <- renderPrint({
summary = summary(dataset())
return(summary)
})
outputOptions(output, "summary", suspendWhenHidden = FALSE)
})
我也曾尝试以下,但没有运气'infile_read = read.xlsx(INFILE $数据通路,1) 回报( infile_read)' – BigDataScientist
把'browser()'放在你读入文件的地方之后。该文件是否正在读入? – MadScone
我在命令行中包含了'browser()'它显示的浏览器>,并在那里停止。没有错误,没有输出。我也尝试过'browser(text =“Done !!”)',但是“完成!!”不打印。 – BigDataScientist