pacman
pacman copied to clipboard
Incorrect handling of `force = FALSE` when installing multiple packages using `p_install`
Consider the following:
-
Pacmanisn't present:> "pacman" %in% installed.packages() [1] FALSE -
Neither is
dplyr:> "dplyr" %in% installed.packages() [1] FALSE -
Install
pacman:> install.packages("pacman") ... * installing *source* package ‘pacman’ ... * DONE (pacman) -
Try reinstall using
force = FALSE- correctly refuses to install ...> pacman::p_install("pacman", force = FALSE) Package is already on your system. -
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.
Thanks for the feedback. We'll look at this.
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.
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()