I have a data frame (df) with has four columns (alpha, beta, gamma and delta). Data in each of the columns is an integer. I’m writing a shiny app in which when the user chooses one of the options (options 1 -4) it matches to an appropriate column name and few manipulations are performed using dplyr package.
For some reason, when I use : “b[match(input$defInput, a)] %in% c(0:14)”, it does not work, though when I manually check “alpha %in% c(0:14)”, it works fine.
I checked the classes of the arguments, and they seem to match. Any suggestions to resolve it would be greatly appreciated!
server <- function(input, output, session) {
filtered <- reactive({
a = c ("Option1", "Option2", "Option3", "Option4")
b = c ("alpha", "beta", "gamma", "delta")
df %>%
filter (b[match(input$defInput, a)] %in% c(0:14))
})
server <- function(input, output, session) {
filtered <- reactive({
a = c ("Option1", "Option2", "Option3", "Option4")
b = c ("alpha", "beta", "gamma", "delta")
df %>%
filter (alpha %in% c(0:14))
})