R - 闪亮找不到 "container"
R - Shiny can not find "container"
我正在尝试创建一个基本的金融闪亮应用程序,它将公司的股票代码作为输入,并利用 quantmod 包中的各种功能来 return 某些信息(损益表、现金流量等) .我正在 运行ning 中,错误显示为 "ERROR: could not find function "container。”我知道大多数时候闪亮的错误是由于某处没有右括号,但情况似乎并非如此我以前玩游戏时没有 运行 遇到过这个错误。感谢任何帮助。
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")
)
})
textOutput
s 没有标签,所以这不起作用:
textOutput("last_price",
"Last Traded Price"),
textOutput("NCAVPS",
"Net Current Asset Value per Share")
第二个参数是container
,一个生成HTML容器的函数。标签必须是分开的,比如
div(
tags$b("Last Traded Price"),
textOutput("last_price")
)
我正在尝试创建一个基本的金融闪亮应用程序,它将公司的股票代码作为输入,并利用 quantmod 包中的各种功能来 return 某些信息(损益表、现金流量等) .我正在 运行ning 中,错误显示为 "ERROR: could not find function "container。”我知道大多数时候闪亮的错误是由于某处没有右括号,但情况似乎并非如此我以前玩游戏时没有 运行 遇到过这个错误。感谢任何帮助。
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")
)
})
textOutput
s 没有标签,所以这不起作用:
textOutput("last_price",
"Last Traded Price"),
textOutput("NCAVPS",
"Net Current Asset Value per Share")
第二个参数是container
,一个生成HTML容器的函数。标签必须是分开的,比如
div(
tags$b("Last Traded Price"),
textOutput("last_price")
)