I am not familiar with the package BatchGetSymbols, but the concepts in the example below should be applicable to your use case.
First of all, due to the lack of an elegant way of saying this, I am sure that the expression ...
stock_info()$return <- reactive({
rep(0, length(stock_info()$ref.date))
})
... , shiny .
, , . , , .
library(shiny)
ui <- fluidPage(
textInput('stock','stock',"GE"),
sliderInput('length', 'length', min = 1, max = 10, value = 5),
dataTableOutput('my_table')
)
server <- function(input, output, session) {
stock_info <- reactive({
length <- as.integer(input$length)
temp_stock_info <- data.frame(stock = input$stock,
foo = seq_len(length),
bar = rnorm(length))
temp_stock_info$baz <- paste("xxx",length)
return(temp_stock_info)
})
output$my_table <- renderDataTable({
stock_info()
})
}
shinyApp(ui, server)
, l.out , . l.out , , .
, , stock_info, , l.out l.out .
library(shiny)
ui <- fluidPage(
textInput('stock','stock',"GE"),
sliderInput('length', 'length', min = 1, max = 100, value = 50),
sliderInput('displayLength', 'displayLength', min = 1, max = 20, value = 5),
dataTableOutput('my_table')
)
server <- function(input, output, session) {
l.out <- reactive({
data.frame(stock = input$stock,
foo = rnorm(input$length),
l.out_update_time = Sys.time())
})
stock_info <- reactive({
tmp_stock_info <- head(x = l.out(), n = input$displayLength)
tmp_stock_info$stock_info_update_time <- Sys.time()
return(tmp_stock_info)
})
output$my_table <- renderDataTable({
stock_info()
})
}
shinyApp(ui, server)