【发布时间】:2014-08-04 06:15:19
【问题描述】:
我的 ui.r
library(shiny)
codes <- paste("CURRENCY:",currencies,sep="")
currencies <- c("ARS","AUD","BRL","CAD","CHF",
"CNY","DKK","EUR","GBP","IDR",
"ILS","INR", "JPY","MXN","MYR",
"NOK","NZD","PHP","RUB","SEK",
"THB","TRY")
shinyUI(fluidPage(
titlePanel("Currency Charts"),
sidebarLayout(
sidebarPanel(
helpText("Select a currency to examine.
Information will be collected from Quandl."),
selectInput("symb",
label = "Choose a variable to display",
choices = currencies,
selected = "ARS"),
dateRangeInput("dates",
"Date range",
start = "2013-01-01",
end = as.character(Sys.Date())),
actionButton("get", "Get Currency"),
br(),
br(),
)
mainPanel(plotOutput("plot"))
)
))
服务器.r
library(quantmod)
shinyServer(function(input, output) {
output$plot <- renderPlot({
data <- getSymbols(input$symb, src = "google",
from = input$dates[1],
to = input$dates[2],
auto.assign = FALSE)
chartSeries(data, theme = chartTheme("white"),
type = "line", TA = NULL)
})
})
问题:我在第 35 行不断收到意外的符号错误。
我基本上复制了 Shiny R 给出的示例代码,但我正在尝试使用他们从 yahoo 获取的股票信息图,而不是使用 google 并绘制货币图。 CURRENCY:XYZ 在谷歌金融中给出 XYZ/USD,这就是 ui.r 的第一部分。我认为问题在于我对 getSymbol() 和 renderPlot() 的使用。有什么建议/修复吗?
【问题讨论】:
标签: r plot currency shiny quantmod