I am a newbie to R, it's definitely been a learning curve and I am still bad at it. I can't really solve this issue myself as I don't really know what I am doing wrong.
library(shiny)
library(dplyr)
library(readxl)
#UI
ui <- fluidPage(
#Title
titlePanel("Testing Shiny"),
#Sidebar Layout
sidebarLayout(
# Sidebar panel
sidebarPanel(
#Input
selectInput("typedata",
label = "What do you want to see?",
list("Count of Job Reqs",
"Candidates")),
selectInput("Work Location", label = "Location", choices = unique(exceldata$"Work Location")),
),
#Main Panel
mainPanel(
#Output
textOutput("selected_typedata"),
textOutput("totalreq"),
plotOutput("plot")
)
)
)
#Server
server <- function(input, output) {
output$selected_typedata <- renderText({
paste("You wanted to see", input$typedata)
})
output$plot <- renderPlot({
ggplot(data=exceldata, aes(x=exceldata$`Application Date`,
y=exceldata$`Candidate ID`, fill=c('steelblue'))) +
geom_bar(stat='Identity', width=0.8)
})
}
#Shiny app
shinyApp(ui = ui, server = server)
What it's doing is not actually graphing anything. I don't know why, it draws the x and y, but not the actual bars. What I am trying to accomplish here is a basic bar graph showing the count of candidate IDs that applied during their application dates.
If someone could point out what I could possibly be doing wrong, I would greatly appreciate it. I tried using (count(exceldata$"Application Date')), but it gives me an error "no applicable method for 'tbl_vars' applied to an object of class "c('double', 'numeric')".
I tried reading documentation, and it just works fine for others. My data comes from a table loaded as a function using read_excel.