0
我想創建一個基本的財務閃亮的應用程序,它需要一個公司的股票代碼,因爲它的輸入和利用quantmod包中的各種功能來返回某些信息(損益表,現金流,等等。)。我遇到和錯誤,讀取,「錯誤:無法找到函數」容器。「我知道大部分時間閃亮的錯誤是由於沒有一個左括號的地方,但似乎並非如此,我玩耍時,之前還沒有遇到這個錯誤。任何幫助表示讚賞。R - 閃亮找不到「容器」
ui.R
library(shiny)
shinyUI(
fluidPage(
titlePanel("Should You Invest"),
sidebarLayout(
sidebarPanel(h3("How It Works"),
"You input the ticker symbol of a company, and this app returns the
Net Current Asset Value per Share, otherwise known as Grahams Rule",
textInput("ticker",
"Company Ticker",
placeholder = "AAPL"),
submitButton("Submit"),
textOutput("last_price",
"Last Traded Price"),
textOutput("NCAVPS",
"Net Current Asset Value per Share")
),
mainPanel(
tabsetPanel(type = "pills",
tabPanel("Annual",
tabsetPanel(type = "tabs",
tabPanel("Balance Sheet",
textOutput("annual_bs")),
tabPanel("Cash Flow",
textOutput("annual_cf")),
tabPanel("Income Statement",
textOutput("annual_is"))
)
),
tabPanel("Quarter",
tabsetPanel(type = "tabs",
tabPanel("Balance Sheet",
textOutput("quarter_bs")),
tabPanel("Cash Flow",
textOutput("quarter_cf")),
tabPanel("Income Statement",
textOutput("quarter_is"))
)
)
)
)
)
)
)
server.R
library(shiny)
shinyServer(function(input, output) {
library(quantmod)
change_ticker <- reactive(function() {
ticker <- input$ticker
adj_ticker <- getFin(ticker)
financial <- get(adj_ticker)
financial
})
output$last_price <- renderTable(
getQuote(ticker)
)
output$annual_bs <- renderText(
viewFinancials(financial, type = "BS", period = "A")
)
output$annual_cf <- renderText(
viewFinancials(financial, type = "CF", period = "A")
)
output$annual_is <- renderText(
viewFinancials(financial, type = "IS", period = "A")
)
output$quarter_bs <- renderText(
viewFinancials(financial, type = "BS", period = "Q")
)
output$quarter_cf <- renderText(
viewFinancials(financial, type = "CF", period = "Q")
)
output$quarter_is <- renderText(
viewFinancials(financial, type = "IS", period = "Q")
)
})