New R installation with your old library collection: a scripting solution
Few days ago, I installed a 'fresh' Windows and used this opportunity to migrate to the newest version of R ( 4.0.3 ) and R Studio ( 1.3.1093 ). At the same time, as most users, I wanted to keep my library collection from the previous installations. There are many ways to achieve that: you may copy your old library folder to the 'fresh' one and update the packages in R, for example. But, because each version of base R has obviously a bit changed internals, you can be almost sure, that the update will fail for a quite number of them. This time I took it as a little challenge and set off to develop a simple tool which 'migrates' my libraries to the new R version. The first step was to get a list of the installed packages in the old R. Provided you it is still up, you may simply retrieve a named matrix with names of the installed packages by calling installed.packages() function. The output is a bit verbose, n fact, you just need the 'Package' column to ...