I need to call a function inside observeEvent (which is based on select input), i need to call two functions, one is to get attribute name and other to get dataset name. i just wanna know how to call the function inside observeEvent.
library(shiny)
library(shinydashboard)
ui<-
selectInput("select", "LPS tolerance induction:", c("", "LPS_Stim. at 0 h vs unstim" , "LOVE_Stim. at 20 h vs unstim",
"Restimulation (stim. at 0 h and 20 h vs unstim.)" ,
"Tolerance (stim. at 0 h and 20 h vs stim. at 20 h)"))
findattribute <- reactive({
if(grepl("LPS",input$select)){
x <- "val1"
return(x)
}
else if(grepl("LOVE", input$select)){
x <- "val2"
return(x)
}
else if(grepl("Res", input$select)){
x <- "val3"
return(x)
}
})
finddataset <- reactive({
if(grepl("LPS",input$select)){
x <- curated_lps # dataset name
return(x)
}
})
server<- function(input, output){
observeEvent(input$select, {
attribute <- findattribute()
dataset <- finddataset()
})
}
shinyApp(ui, server)