I'm trying to filter my data set based on one/multiple inputs for a variable. My data set exists of concentration, time and #study data. Normally, if I would want to filter my data set based on study number(s), I would enter this code:
df %>% filter(study == "1.3" & study == "2.1")
Anyways, I want to create a Shiny app and allow users to visualize data based on a filter. For example, I'd want them to only visualize concentration/time data for a certain study (Toxicity/Single dose/Repeat dose). I'm quite new to Shiny, so I read some information on the function reactive(), but I don't think I understand it good enough yet. But, I want to show you guys my complete code.
df <- MadeUpDataSet
df <- df %>% filter(DV > 0.0533)
#df$DV <- as.numeric(as.character(df$DV))
#df$TIME <- as.numeric(as.character(df$TIME))
# Define UI for application 
ui <- fluidPage(
    
    tabsetPanel(tabPanel("Tab 1",
                         
                         titlePanel("Shiny App: Concentration vs Time Graphs"),
                         
                         sidebarLayout(
                             mainPanel("Concentration vs Time graphs",
                                       plotOutput(outputId = "plot")
                             ),
                             sidebarPanel(helpText("This app is developed to visualize pharmacokinetic data of different antibodies..."),
                                          selectInput(
                                              inputId = "study",
                                              label = "Include study:",
                                              choices = c("GLP Toxicity" = "ME1044-011", "Dose Range Finding", "Single Dose", "Repeat Dose"),
                                              selected = "ME1044-011",
                                              multiple = T
                                          ),
                                          selectInput(
                                              inputId = "x",
                                              label = "X-axis:",
                                              choices = c("Time" = "TIME", "TLD"),
                                              selected = "Time"
                                          ),
                                          selectInput(
                                              inputId = 'column',
                                              label = "Columns for:",
                                              choices = c("Dose mg/kg" = "DOSEMGKG", "Species" = "SPECIES", "Antibody" = "ABXID", "Subspecies" = "SUBSPECIES", "Age" = "AGE", "Animal ID" = "ANIMALID"),
                                              selected = "DOSEMGKG"
                                          ),
                                          selectInput(
                                              inputId = 'row',
                                              label = "Rows for:",
                                              choices = c("Dose mg/kg" = "DOSEMGKG", "Species" = "SPECIES", "Antibody" = "ABXID", "Subspecies" = "SUBSPECIES", "Age" = "AGE",  "Animal ID" = "ANIMALID"),
                                              selected = "ABXID"
                                          ),
                                          selectInput(
                                              inputId = "group",
                                              label = "Group by:",
                                              choices = c("Dose mg/kg" = "DOSEMGKG", "Species" = "SPECIES", "Antibody" = "ABXID", "Subspecies" = "SUBSPECIES", "Age" = "AGE",  "Animal ID" = "ANIMALID"),
                                              selected = "ANIMALID"
                                          ),
                                          sliderInput(
                                              inputId = 'trange',
                                              label = "Time range:",
                                              min = 0,
                                              max = 1704,
                                              value = c(0, 1704 )
                                          )
                             ))
                         
    )),
    
    
    
    tabsetPanel(tabPanel("Tab 2",
                         
                         titlePanel("Tab 2"),
                         
                         sidebarLayout(
                             mainPanel("Plot #2", plotOutput(outputId = "plot2")
                             ),
                             sidebarPanel(helpText("Whatever text..."),
                                          selectInput(
                                              inputId = 't',
                                              label = "Example",
                                              choices = c("#1", "#2", "#3"),
                                              selected = "#1"
                                          )
                             )
                         )))
)
# Define server  
server <- function(input, output, session){
    
    **df <- reactive({df %>% filter("STUDYID" == input$study)})**
    
    output$plot <- renderPlot({
        ggplot(data = df, aes_string(x = input$x, y = "DV", col = input$group)) + xlab("Time") + ylab("Concentration (ug/mL)") +
            geom_point() + facet_grid(get(input$row) ~ get(input$column)) + scale_x_continuous(limits = input$trange) + theme_bw() })
    
}
shinyApp(ui = ui, server = server)
Notes: I'm still working on the second tab, so that can be forgotten. Anyways, I hope that the code is understandable. So I tried to include the code between the ** **. But then I receive this error:
Warning: Error in :   You're passing a function as global data.
Have you misspelled the data argument in ggplot()
I hope you guys get my question. I'm pretty sure there's a simple answer to this question, but I'm not so familiar with Shiny etc.
