【发布时间】:2016-01-03 19:22:43
【问题描述】:
对象是来自用户的gettig参数,以使他们了解预测技术。因此,我想从移动平均线开始。尽管工作很简单,但我无法管理并且遇到了一些问题。
- 出现一个错误:错误:缺少需要 TRUE/FALSE 的值。
我不明白为什么会得到这个?
- 我想显示下一个期间的预测值。但是这个现成的公式不能提供吗?
`
library(shiny)
shinyUI(pageWithSidebar(
headerPanel("Forecasting Methods"),
sidebarPanel(
h3(strong("Moving Average",style = "color:black")),
br(),
sliderInput("ord","Order Size:",min = 1, max = 100, step= 1, value = 15),
),
mainPanel(
plotOutput(outputId = "ma1", width = "700px",height = "400px"))
))
library(shiny)
library(ggplot2)
library(forecast)
library(TTR)
shinyServer(function(input, output){
output$ma1 <- renderPlot(
tmp <- data.frame(time = 1:100, sales = round(runif(100, 150, 879))),
sm <- SMA(tmp[,"sales"],order=input$ord),
y <-ggplot(tmp, aes(time, sales)) + geom_line() + geom_line(aes(time,sm),color="red") + xlab("Days") + ylab("Sales Quantity")+ ggtitle("Moving Average"),
y
)
})
【问题讨论】: