So here's my code below, that I can't get Shiny to show the data in the graph. It just shows the column name, and not the data. Any suggestions?
The data are just showing up in a row in the graph instead of being correctly plotted. I've tried going through the examples in the R Shiny cheat sheet, but no luck.
budget_d <- tribble(~opdate, ~r.pd.bdgt, ~r.pt.bdgt, ~r.au.bdgt,
ymd("2018-05-31"), 81, 73, 65,
ymd("2018-06-11"), 86, 79, 69,
ymd("2018-06-30"), 89, 76, 67,
ymd("2018-07-21"), 82, 72, 65,
ymd("2018-08-01"), 81, 73, 63,
ymd("2018-08-08"), 83, 75, 67,
ymd("2018-11-17"), 84, 74, 66)
require(shiny)
require(tidyverse)
require(lubridate)
ui <- fluidPage(
dateRangeInput(
inputId = "period",
label = "Choose a Period",
start = ymd("2018-04-01"),
end = ymd("2018-09-01"),
min = ymd("2018-01-01"),
max = ymd("2018-12-31")
),
selectInput(
inputId = "elements",
label = "Select an Element",
choices = c("Pd Recovery" = "r.pd.bdgt",
"Pt Recovery" = "r.pt.bdgt",
"Au Recovery" = "r.au.bdgt")
),
plotOutput(
outputId = "hist"
)
)
server <- function(input, output){
output$hist <- renderPlot({
ggplot(budget_d, aes(opdate, input$elements)) +
geom_point() +
xlim(input$period)
})
}
shinyApp(ui = ui, server = server)