0

How can I get a dataframe of all the packages that have a more recent version in CRAN? For example:

df <- check_outdated_packages() # please create this function

>df
     package    installed_version    latest_cran_version
      <char>               <char>                 <char>
1: reactable                0.3.0                  0.4.4
Vlad
  • 3,058
  • 4
  • 25
  • 53

1 Answers1

6

?old.packages says:

‘old.packages’ indicates packages which have a (suitable) later version on the repositories whereas ‘update.packages’ offers to download and install such packages.

it returns:

‘NULL’ or a matrix with one row per package, row names the package names and column names ‘"Package"’, ‘"LibPath"’, ‘"Installed"’ (the version), ‘"Built"’ (the version built under), ‘"ReposVer"’ and ‘"Repository"’.

On my system right now:

        Package    LibPath                         Installed Built   ReposVer
admisc   "admisc"   "/usr/local/lib/R/site-library" "0.31"    "4.3.0" "0.32"  
clock    "clock"    "/usr/local/lib/R/site-library" "0.6.1"   "4.3.0" "0.7.0" 
markdown "markdown" "/usr/local/lib/R/site-library" "1.6"     "4.4.0" "1.7"   
rticles  "rticles"  "/usr/local/lib/R/site-library" "0.24"    "4.3.0" "0.25"  
MASS     "MASS"     "/usr/local/lib/R/library"      "7.3-59"  "4.4.0" "7.3-60"

         Repository                               
admisc   "https://cloud.r-project.org/src/contrib"
clock    "https://cloud.r-project.org/src/contrib"
markdown "https://cloud.r-project.org/src/contrib"
rticles  "https://cloud.r-project.org/src/contrib"
MASS     "https://cloud.r-project.org/src/contrib"

(I thought I remembered this existed: I did apropos("package") to find it.)

Ben Bolker
  • 211,554
  • 25
  • 370
  • 453