Learn R Programming

spsComps (version 0.1.0)

shinyCheckPkg: Shiny package checker

Description

A server end function to check package namespace for some required packages of users' environment. If all packages are installed, a successful message will be displayed on the bottom-right. If not, pop up a message box in shiny to tell users how to install the missing packages.

This is useful when some of packages are required by a shiny app. Before running into that part of code, using this function to check the required pakcage and pop up warnings will prevent app to crash.

Usage

shinyCheckPkg(
  session,
  cran_pkg = NULL,
  bioc_pkg = NULL,
  github = NULL,
  quietly = FALSE
)

Arguments

session

shiny session

cran_pkg

a vector of package names

bioc_pkg

a vector of package names

github

a vector of github packages, github package must use the format of "github user name/ repository name", eg. c("user1/pkg1", "user2/pkg2")

quietly

bool, should warning messages be suppressed?

Value

TRUE if pass, sweet alert massage and FALSE if fail

Examples

Run this code
# NOT RUN {
if(interactive()){
    shinyApp(ui = shinyUI(
        fluidPage(actionButton("haha", "haha"))
    ), server = function(input, output, session){
        observeEvent(input$haha,
            shinyCheckPkg(session, cran_pkg = c("pkg1", "pkg2"),
                          bioc_pkg = "bioxxx", github = "user1/pkg1"))
    })
}
# }

Run the code above in your browser using DataLab