我使用fileInput小部件开发了一个闪亮的应用程序。 这个在我运行我的应用程序时运行(运行应用程序,在Windows中运行并运行外部程序)。
当我在网络上部署我的应用程序时,这个可行(我说是因为,下载栏发生了变化(我们可以看到下载进程)。但文件没有出现......
你知道吗?这是一个可重复的例子:
ui.R
shinyUI( navbarPage("StatLab",inverse =T, fluid=T,position = c("static-top"), #cerulean/spacelab/cosmo shinytheme("spacelab")
tabPanel("Introduction",
sidebarPanel(width = 3,
br(),
# tags$img(src="Groupe-Clarins-2015.png",height=200 , width=300),
br(),
br(),
br(),
textInput("titredoc", label=strong("Titre du document"), value="Entrez le titre du document genere")
),
mainPanel(
h3("blablalba")
)
)
,
#######onglet 2 load data #######
tabPanel("Chargement des donnees et mise en forme",
splitLayout(
# width = 3,
shinyjs::useShinyjs(),style = "border: 1px solid silver;",
id = "side-panel",
cellWidths = c("0%","25%","25%", "20%","15%","15%"),
# cellWidths = 200,
column(6,
fileInput('datafile', h4('Choix du fichier'), multiple=F),
helpText("uniquement fichier xlsx/xls acceptes"),
actionButton("reset_input", "Reset"),
helpText("Ce bouton permet de supprimer tous les choix")
)
),
tags$hr(),
mainPanel(DT::dataTableOutput('contents')
))
))
这是server.R
shinyServer(function(input, output,session) {
library(xlsx)
filedata <- reactive({
infile <- input$datafile
if (is.null(infile)) {
return(NULL)
}
read.xlsx(infile$datapath, sheetIndex=1, header = T)
})
#### pour visualiser la table
output$contents <- renderDataTable({
if(is.null(input$datafile)){
return()
}
filedata()
})
session$onSessionEnded(function() {
stopApp()
})
})
更重要的是,当我在Rstudio中部署时: 我有这样的信息:
Preparing to deploy application...DONE
Uploading bundle for application: 96490...Detecting system locale ... DONE
Deploying bundle: 427631 for application: 96490 ...
Waiting for task: 180508025
building: Parsing manifest
building: Installing packages
building: Installing files
building: Pushing image: 420587
deploying: Starting instances
unstaging: Stopping old instances
Application successfully deployed to
Warning message:
Error detecting locale: Error in read.table(file = file, header = header, sep = sep, quote = quote, : incomplete final line found by readTableHeader on 'raw'
(Using default: en_US)