4

In my job it is essential that all staff are using the same version of R and the same version of each package.

I have created a local CRAN repository and a function that installs straight from this repository.

The problem is at my work there is a lot of staff and the only way to ensure everyone has done this is to manually check myself.

I was wondering if there exists a way to automatically check that you have the correct package installed?

For example if boot_1.3-18 is the package I wish everyone to use, can I make a function to check whether an R library contains this version?

Also if possible (but not essential) to do this with the version of R being used would be fantastic!

Much thanks in advance!

6
  • 3
    You can access the package version through packageDescription("packagename")$Version. You can see the same for all installed packages using install.packages()[,c("Package", "Built")]. Does that help? Commented Jul 27, 2016 at 9:42
  • Perfect, just what I was looking for many thanks. Is there a similar way to do this for the version of R that is being used? Commented Jul 27, 2016 at 9:54
  • Maybe use MS Open R, or use VM to have one R shared by all users. Commented Jul 27, 2016 at 10:03
  • So for different projects they are forced to use the same versions? Boy would I hate to work there … Commented Jul 27, 2016 at 10:30
  • Hi Konrad, no I probably didn't explain very well. It is the same project for all that need locked down package versions. Commented Jul 27, 2016 at 10:32

1 Answer 1

3

Checking versions for a specific package

You can access the package version through. An example for the abind package:

packageDescription("abind")$Version
# [1] "1.4-3"

Checking versions of all installed packages

installed.packages()[,c("Package", "Built")] 
# Gives an overview of all installed packages and the versions of those packages.
#                   Package            Built  
# abind            "abind"            "3.2.3"
# BradleyTerry2    "BradleyTerry2"    "3.2.3"
# brglm            "brglm"            "3.2.3"
# car              "car"              "3.2.4"
# caret            "caret"            "3.2.4"
# colorspace       "colorspace"       "3.2.4"
# devtools         "devtools"         "3.2.5"
# (...)

Checking current version of R

sessionInfo()$R.version$version.string
# [1] "R version 3.2.3 (2015-12-10)"
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.