How to integrate module with shiny app

shiny-modules

#1

Hi,

I have created a module to add functionality to my app.R. The module is an app.R that works fine on its own, but now I need to integrate it with my app so that it executes as part of the app. How can I do that?

thanks


#2

https://shiny.rstudio.com/articles/modules.html


#3

Thank you for your response. I have installed devtools::install_github('klmr/modules'). The module is called app.R and is in its own directory -INSERTUI_EXAMPLE-.

I have placed the statement app = import("INSERTUI_EXAMPLE/app.r) in my app and I get the message:
Error in import_("INSERTUI_EXAMPLE/app.r") :slight_smile: Unable to load module ‘INSERTUI_EXAMPLE/app.r’; not found in ‘/home/giuseppa/Development/fileTest’.

If I use source("INSERTUI_EXAMPLE/app.R) from the working directory, I do not get an error, but I do not know how to access the functions of the module so that they get executed as part of the main app.R

My module has a ui <- fluidPage(
UI
)
a server <- function(input, output, session){} which contains the function calls to the UI functions ans the server funnctions.

If I insert the fluidPage() content of the module into the fluidPage() of the main app and insert the server content of the module into the main app server, and if I insert the server and gui functions outside the server and outside the fluidPage() the function call to the GUi function made by the server and by the fluidPage cannot be found. I do not see why this should not work


#4

Thanks. I could integrate the module with my app following the directions and example in the tutorial link that you sent me.