我可以从用户那里获取输入日期,但是无法在输入日期后等待执行。 库(闪亮) 库(GGPLOT2) 库(quantmod)
# Define UI for application that draws a bar graph
ui <- fluidPage(
# Application title
titlePanel("My Plot"),
sidebarLayout(
sidebarPanel(
textInput("text", "Enter company name:", width = NULL,
placeholder = "comp.name"),
dateRangeInput("dates", h3(strong("Date Range")),
start = "2001-01-01", end = Sys.Date(),
min = "0000-01-01", max = Sys.Date(),
format = "dd-mm-yy", separator = strong("to"),
autoclose = TRUE),
submitButton(text = "submit")),
# Show a plot
mainPanel( h1(strong(textOutput("Company"))),
tableOutput("MRF"),
plotOutput("finally")
)
)
)
# Define server logic required to draw a histogram
server <- function(input, output) {
output$MRF <- renderTable({
tyu2 <- getSymbols(input$text , src = "yahoo", verbose = TRUE,
from = min(input$date) , to = max(input$date), auto.assign = FALSE)})
output$finally <- renderPlot({ggplot(data = tyu2 , aes(x= x ,y=tyu))+
geom_bar(stat = "identity", fill = "blue")+
theme(axis.text.x = element_text(angle = 90)) +
xlab("Dates")+ ylab(comp.name)})
}
# Run the application
shinyApp(ui = ui, server = server)
日期必须以无穷大的形式进行,这是未读取日期时的默认情况。我不明白什么是错的。有人可以帮帮我吗谢谢