我试图在shine中绘制一个数据库,但我想上传一个输入文件为shine的数据库。当我用这些线绘制数据库时:
Resumen<-read.xlsx("vectores.xlsx")
plot.ts(Resumen)
它的情节很好。然而,当我试图通过上传带有输入$file1的数据库来绘制相同的图时,存在这样的错误";需要有限的ylim值";。这是我的密码,谢谢你抽出时间。
library(shiny)
ui = fluidPage(
titlePanel("plotprueba"),
sidebarLayout(
sidebarPanel(
fileInput("file1", "label", accept = ".xlsx")
),
mainPanel(
tabsetPanel(type="tab",
tabPanel("Grafica", plotOutput("plot1"))
)
)
)
)
server = function(input, output,session) {
output$plot1 <- renderPlot({
#setwd ("C:/Users/Usuario/Desktop")
#Resumen<-read.xlsx("vectores.xlsx")
inFile <- input$file1
plot.ts(inFile)
})
}
shinyApp(ui = ui, server = server)```
我们可以将server
更改为
server = function(input, output,session) {
output$plot1 <- renderPlot({
req(input$file1)
inFile <- input$file1
plot.ts(read.xlsx(inFile$datapath))
})
}