Skip to content

Instantly share code, notes, and snippets.

@jansim
Created July 3, 2023 15:23
Show Gist options
  • Save jansim/b89ab4a841a8c9cbf4228bb3a199f768 to your computer and use it in GitHub Desktop.
Save jansim/b89ab4a841a8c9cbf4228bb3a199f768 to your computer and use it in GitHub Desktop.
Updating all reverse dependencies of an R package at once

I recently received the following error when rendering the vignettes for an R package I'm developing as part of R CMD CHECK.

The function xfun::isFALSE() will be deprecated in the future. Please consider using base::isFALSE(x) or identical(x, FALSE) instead.

As it wasn't clear which package exactly was calling the offending function (xfun::isFALSE), I just wanted an easy way of upgrading all packages that may be using it. The following snippet does just that.

library(tidyverse)
the_pkg_name <- "xfun"
# Find all packages depending on the package
all_revdeps <- devtools::revdep(the_pkg_name)
packages_to_update <- installed.packages() %>%
as.data.frame() %>%
rownames_to_column("pkg_name") %>%
filter(pkg_name %in% all_revdeps) %>%
pull(pkg_name)
install.packages(packages_to_update)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment