trinker / pacman

A package management tools for R
314 stars 37 forks source link

Incorrect handling of `force = FALSE` when installing multiple packages using `p_install` #121

Open r-cheologist opened 5 years ago

r-cheologist commented 5 years ago

Consider the following:

  1. Pacman isn't present:

    > "pacman" %in% installed.packages()
    [1] FALSE
  2. Neither is dplyr:

    "dplyr" %in% installed.packages()
    [1] FALSE

  3. Install pacman:

    install.packages("pacman") ...

    • installing source package ‘pacman’ ...
    • DONE (pacman)
  4. Try reinstall using force = FALSE - correctly refuses to install ...

    pacman::p_install("pacman", force = FALSE) Package is already on your system.

  5. BUT when including the reinstall in a multiple-package install, it's reinstalled:

    pacman::p_install(c("pacman", "dplyr"), force = FALSE) ...

    • installing source package ‘pacman’ ...

I consider this a bug. the vector of names of packages to be installed should be checked against presence first and then the installation action should run using the uninstalled subset.

trinker commented 5 years ago

Thanks for the feedback. We'll look at this.

seb-mueller commented 4 years ago

Has this issue been resolved? I stopped using pacman a while ago because of this bug but would if give it another go if this is handled correctly now.

burgerga commented 3 years ago

Can confirm, also the documentation is outdated, as it still describes character.only being applicable to ... and not to package.

PS I'm looking for a p_load alternative that doesn't load the packages (for use in https://github.com/ropensci/targets), and I was expecting p_install to be just that, but now I need to use something like:

p_load(tidyverse)
c("biglm", "dplyr", "ggplot2", "readr", "targets", "tidyr") %>% 
  walk(p_install, force = F, character.only = T) %>% 
  suppressMessages()