I am trying to create a data frame whose content changes based on the inputs of the user of the dashboard. I have set up the empty data frame and the input like so:
selectInput("ai_issue",
label = "Select Issue Area:",
choices = c("Environment",
"Human rights",
"Refugee relief"))
beta <- as.data.frame(matrix(rep(0), nrow = 3))
beta$levels = c("Environment", "Human Rights", "Refugee Relief")
I am wanting to code the beta data frame so that if the user selects 'Environment' from the drop down of the ai_issue object the appropriate cell within the beta data frame will change to 1. Does anyone know how to do this?
selectInput
meets your needs (rather than, for example, an "add" button)? If someone selects "Human rights" or "Refugee relief" will the data change as well? And if you select a choice repeatedly going back and forth between choices should the data continue to change? Likely, you could use something like areactiveVal
to contain a manipulated data frame. - Ben