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