Skip to content

support pacman in library loading and installation #156

@xhdong-umd

Description

@xhdong-umd

I like to use pacman for loading packages, because I can write this and share my code to others.

if (!require("pacman")) install.packages("pacman")
pacman::p_load(shiny, DT, data.table)

They can just run the code and install packages they don't have automatically. If I used library() they will need to find every missing package and install them manually before the script can work.

However this doesn't work when deployed to shinyapps.io. Because shinyapps only look for library to install packages, and there is a explicit install.packages call in the script which is not allowed in shinyapps.

Right now I'm deploying my shiny apps both in shinyapps.io and github. People can run my app in github directly with shiny::runGitHub. Because of this limit, I cannot use the pacman lines in my code which make the github deployment less perfect.

Is it possible to extend shinyapps to support this usage? It should not be hard, just

  1. ignore the install.packages line since it will never success anyway
  2. scan the packages in this script. Just add pacman and all packages appeared in p_load call to the packages dependency list.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions