1
我最近開始使用R-Shiny,而且我有一個簡單的問題,因此我被卡住了。R使用用戶選擇變量的Shiny Reactive plot
所以,我試圖建立一個反應折線圖,其中用戶定義了數據庫中的2個變量。
我已經能夠得到下拉列表的變量列表,但我無法使用選定的值來繪製折線圖。
參考代碼:
library(shiny)
shinyUI(fluidPage(
# Application title
titlePanel("ARIMAX Forecasting Tool"),
sidebarLayout(
sidebarPanel(
...
mainPanel(
tabsetPanel(type = "tabs",
tabPanel("Plot", plotOutput("plot")),
tabPanel("Summary")
)
)
)
))
和部分服務器代碼
shinyServer(function(input, output) {
output$plot <- renderPlot({
inFile <- input$file1
if (is.null(inFile))
return(NULL)
content1=read.csv(inFile$datapath, header=input$header, sep=input$sep
)
h=input$x
k=input$ts
plot(content1$k,content1$h,type="l")
})
})
我跳過了,我寫的渲染UI的部分,以獲取用戶選擇variables.x
和ts
是變量由用戶選擇折線圖。
我得到一個錯誤,在主面板區域:
需要有限XLIM值