Skip to content

Is this the normal way to install packages when building the book? #1749

Description

@Dantescur

Hi! I'm new to R and trying to build the book locally to learn offline. When I run quarto render after cloning, I keep getting "package not found" errors and have to install them one by one:

  1. quarto render → "no package called 'tidyverse'"
  2. install.packages("tidyverse")
  3. quarto render → "no package called 'nycflights13'"
  4. install.packages("nycflights13")
  5. Repeat...

This is pretty frustrating as a beginner. Is this how it normally works?

Would it be possible to add a simple script like install-deps.R that installs all needed packages at once? Something like:

# install-deps.R
packages <- c("tidyverse", "nycflights13", "maps", "tidymodels")
for (pkg in packages) {
  if (!requireNamespace(pkg, quietly = TRUE)) {
    install.packages(pkg)
  }
}

Or maybe just list all required packages in the README?

I'm happy to help make a PR if this would be useful! Just wondering if the current approach is intentional or if there's a better way.

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions