I develop code in R on multiple computers. Said code depends on many CRAN packages, and I want to make sure that the version of the packages my code depends on are kept in sync. So I am looking for a easy way of replicating a list of installed CRAN packages (with the same version) on another computer.
For people who also know Python, I am looking for an equivalent to pip freeze
. Running pip freeze
prints out a list of packages installed with their version. Then on another computer, I can feed this file back to pip and it installs the exact same version of all the packages listed. (What I do not want is something that installs the latest version on the other computer.)
Is there an easy way of doing this in R (or a tool that already does this), or do I have to roll my own?
Have you looked at installed.packages()
?
R> IP <- installed.packages()
R> colnames(IP)
[1] "Package" "LibPath" "Version" "Priority" "Depends" "Imports"
[7] "LinkingTo" "Suggests" "Enhances" "OS_type" "License" "Built"
R> dim(IP)
[1] 284 12
R>
You could then roll a corresponding install.packages()
over it on the other side, possibly with an additional layer of fetching versions from the 'Archive' section on CRAN.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With