Is there a way to call input$ from another file other than ui and server

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,]
}

I suppose you could use modules and call them from other modules.

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.