Hi all,
I wanted to check if we can call input$ from any other R file other than ui.R and server.R?
app.R
library(shinydashboard)
library(shiny)
library(dplyr)
source("fun.R")
ui <- selectInput("beverage", "Choose a beverage:", choices = unique(df$a)),
uiOutput("sd")
server <- function(input, output, session) {
output$sd <- renderUI({
selectInput("beverage1", "Choose a beverage:", choices = df()$b)
})
}
fun.R
library(dplyr)
library(shiny)
source("app.R")
df <- data.frame(a = c("Tea", "Coffee", "Cocoa","Tea", "Coffee", "Cocoa"), b = c(1,2,3,4,5,6))
df_fil <- function(){
df[df$a == input$beverage,]
}