developing shiny app as a package and deploying it to shiny server

后端 未结 3 725
执笔经年
执笔经年 2020-12-07 08:20

I am developing a shiny app and since I wanted to use automated testing and documentation of the function, I started to develop the interface within a package (as recommende

3条回答
  •  伪装坚强ぢ
    2020-12-07 08:57

    When I make shiny applications as a stand-alone package, I usually organize the files as so:

    In the R directory:

    • All of my methods to support the application (these should be exported if they will be used in either the ui.R, server.R, or global.R files)
    • A launch_application function

    The definition of launch_application is similar to:

    launch_application <- function(x, ...)
    {
      shiny::runApp(appDir = system.file("application", package = [my_pkg]),
                    ...)
    }
    

    In the inst directory

    • application/server.R
    • application/ui.R
    • application/global.R

    After building and installing the package, I then just need to run

    library(my_pkg)
    launch_application(...)
    

提交回复
热议问题