iA


Staying up to date on R packages

by Karthik Ram. Average Reading Time: less than a minute.

Unless you regularly use particular R packages,  it’s becomes difficult to stay on top of updates and bug fixes.  Updates usually also include significant improvements in performance.  I wrote this short snippet of code which I run about once a month to keep up on updates. This short bit of code will give you a list of changes and decide which ones to update:

installed<-installed.packages()
available <-available.packages()
ia <- merge(installed, available, by="Package")[,c("Package", "Version.x", "Version.y")]
updates<-ia[as.character(ia$Version.x) != as.character(ia$Version.y),]
updates

If you would like to install every available update:

update.packages()

If you would like to keep up on new packages being released, I highly recommend following @CRANberries

One comment on ‘Staying up to date on R packages’

  1. Gavin Simpson says:

    You might be interested in the function `old.packages()` which tries to do what your code does. Also, note that if you have installed a version of a package that is newer than the one on CRAN (say a version from R-Forge) then your code will list it even though the local version is newer.

Leave a Reply