Backup R Package List

It's the fall holidays, so its time to upgrade my main machine to the latest version of OS X.  I should  mention that I'm not doing an upgrade, but a clean install of El Capitan.  Its a pain in the neck to have to do a clean install, but past upgrade experiences with Lion, Mountan Lion, and Mavericks, have pretty much soured me on "upgrades".  No señor.  No upgrades.

I have a lot of third-party packages installed for R, Perl, Python, etc., and part of the drill is to make a list of these packages so I can re-install them after the OS is ready.

I use the R script below to get a list of the installed packages, and save this list to a ".txt" file in the Desktop.  Its a simple one-liner that isn't complicated:

write.table( rownames(installed.packages()) , file=paste( "~/Desktop/", format(Sys.time(), "%Y-%m-%d"), "-R_Packages.txt", sep="" ), append=FALSE, row.names=TRUE, col.names=NA, quote=FALSE, sep="\t", na="0" )

Currently, I eye-ball the list after installing R and add the missing packages by hand.  Yeah, I know... But I'm working on a script that will take the file created by the code above as input, and compare its list to the currently installed packages — any missing packages will be installed automatically.

Should have it soon.  I'll update this post once its ready and add it to GitHub.