-1

I have a dataset that has job postings in it. For some reason, my app doesn't update the table after the first update. For example if I choose Business Intelligence Analyst and CA as inputs, I get a table with said jobs. Yet, a change in inputs gives me a blank table. Any recommendations here?

jobsdata <- read.csv("D:/UMBC IS PHD Career/IS 725 Information Extraction/Code for Project/Project/finaljobdata.csv")

ui<- fluidPage(
  titlePanel("Find an Information System related Job"),
  sidebarLayout(
    sidebarPanel(
      selectInput(inputId = "jtitle",
              label = "Choose a Job title:",
              choices = unique(jobsdata$JobID),
              selected = "System Analyst"),

      selectInput(inputId = "place",
              label = "Choose a Location:",
              choices = unique(jobsdata$Stateid),
              selected = "MO"),

      actionButton(inputId = "press",
               label="Update for Job list")
    ),
  mainPanel(
    tableOutput("jobs")
  )

  )

)


server<- function(input, output){

  RV <- reactiveValues(data=jobsdata)

  output$jobs<-renderTable({
    RV$data

 })

  observeEvent(input$press,{
    RV$data <-RV$data %>% 
      filter(JobID==input$jtitle & Stateid == input$place)
  }) 
}
shinyApp(server = server, ui=ui)

1 Answers1

0

Firstly, you should put some dummy data in so that the code is able to be run instead of jobsdata <- read.csv("D:/UMBC IS PHD Career/IS 725 Information Extraction/Code for Project/Project/finaljobdata.csv") I believe your issue is that you update the same reactive value, so the dataframe becomes empty once you run your code. Changing your observeEvent code to this should fix the issue:

    RV$data <-jobsdata %>% 
      filter(JobID==input$jtitle & Stateid == input$place)
  })