Link Search Menu Expand Document

R Package Dependencies

The MDI apps framework loads and attaches a set of commonly used R packages that you may use when writing your app code, listed here:

App-specific R package declarations

The suite-level packages.yml file and all app and module configuration files can declare additional R package dependencies required for an app to function, as follows:

# suite-level: shiny/shared/global/packages/config.yml
# app and module level: various config.yml or module.yml files
packages:
    R: 
        - <packageName>
        # etc.
    Bioconductor: null # or a list of packages as for "R"

The R key lists general R packages, e.g., those on CRAN. Bioconductor is self-evident.

It is not harmful to re-declare R packages already listed elsewhere, they will only be installed once.

Installing vs. attaching

R packages listed in the the mdi-apps-framework package.yml file are attached and their functions can be called directly, e.g., Shiny’s observeEvent().

In contrast, packages declared in a tool suite are installed but are never attached using the library() function. Thus, you must either:

  • call functions in full syntax, e.g., package::function() (preferred)
  • call library(package) yourself (discouraged, you could break the framework)