我有一個問題來編碼一個應用程序,是預測庫的情節,並沒有顯示出來。閃亮的預測情節
- 我想用滑塊範圍輸入這個繪圖,所以你可以設置置信度。用「級別」表示。
- 不要太注意複選框。
下面的代碼:
library(shiny)
ui <- fluidPage(
(titlePanel("app | Forecast Models", windowTitle =
"app")),
#Range Input
sliderInput(inputId = "range",
label = "Set Confidence Interval",
min = 0,max = 100, value = c(60,90),
step = NULL,
plotOutput(outputId = "percent")),
#Checkbox input
checkboxGroupInput(inputId = "checkbox", label = "Select Forecast",
choices = c("Trend","Level"),
plotOutput(outputId = "hist"), inline = T))
#server.R
library(forecast)
timese <- ts(WWWusage, start= c(2008,1), end= c(2016,1), frequency=12)
fit <- StructTS(timese,"trend")
server <- function(input, output) {
output$percent <- renderPlot({
plot(forecast(fit,
#Confidence Interval %
level = c(input$range)), sub= "Confidence Interval 70% ~ 90%
or Determined by user", ylab= "Y Axis Variable",
main=
"Forecast Linear Structural Model @ Trend-Wise",
ylim = c(0,400))
})
}
shinyApp(ui = ui, server = server)
非常感謝。如果它允許我在幾分鐘內打勾綠色。 –