Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better Framework For Data Byte/Recipe Package Installation #28

Open
njlyon0 opened this issue Sep 30, 2022 · 2 comments
Open

Better Framework For Data Byte/Recipe Package Installation #28

njlyon0 opened this issue Sep 30, 2022 · 2 comments
Labels
question Further information is requested

Comments

@njlyon0
Copy link
Member

njlyon0 commented Sep 30, 2022

Problem

  • Currently each data byte/recipe uses library to invoke the R packages necessary for each
  • However, this means that you cannot render the website if you are missing any of those R packages
  • Particularly a problem for non-CRAN packages because it is not immediately obvious how to install them
  • Discovered when making the edits included in this pull request

Solution(s)

  • Use librarian::shelf to install/load packages
    • Pros: handles CRAN / GitHub / Bioconductor packages without special tweaks; installs packages only when necessary, otherwise just attaches them (functionally is library + install.packages + remotes::install_github wrapped into one)
    • Cons: does still require everyone to install librarian
  • Build install.packages and remotes::install_github calls into every .qmd that references a package
    • Pros: explicit about package source and uses familiar tools
    • Cons: installation of every package on every use of quarto render will make rendering the website take a long time as we add more data bytes/recipes
  • Some other solution?...
@njlyon0 njlyon0 added the question Further information is requested label Sep 30, 2022
@cullen-molitor
Copy link

I have been going with the following lately which I rather like:

if (!require(librarian, quietly = T)){
  install.packages('librarian')
}

librarian::shelf(
  tidyverse,
  here,
  quiet = T
) 

@camilavargasp
Copy link
Contributor

Run into this issue when rendering the website, and I did not have ggsvg installed.
I updated the ggsvg.qmd with Cullen's suggestion. The only thing to remember is that if the package is being installed from GitHub you need to add the user name and package name.

image

The code looks like this

# load libraries
if (!require(librarian, quietly = T)){
  install.packages('librarian')
}

librarian::shelf(
  tidyverse,
  here,
  palmerpenguins,
  coolbutuseless/ggsvg,
  quiet = T
) 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants