Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
And I had to do it again: I am using R installed from homebrew, and after the upgrade from Mavericks to Yosemite, I had to re-install all packages – or was it a GCC upgrade? I don’t know – but I had to do it again.
I still had the link to Randys Zwitch’s solution but I think there were some shortcomings. His solution is as follows:
## Get currently installed packages package_df <- as.data.frame(installed.packages("/Library/Frameworks/R.framework/Versions/2.15/Resources/library")) package_list <- as.character(package_df$Package) ## Re-install Install packages install.packages(package_list)
The shortfalls were:
- hard coded path to the library
- I don’t like factors…
- I want (need) to install from source
So I just revised the script slightly and came up with this solution:
install.packages( lib = lib <- .libPaths()[1], pkgs = as.data.frame(installed.packages(lib), stringsAsFactors=FALSE)$Package, type = 'source' )
Very similar, but, most importantly, the path is not hardcoded.
Hope this helps somebody.
Cheers and enjoy life,
Rainer
P.S: The enjoy life has become more important for me – a friend died in an helicopter crash and he left his wife with two little children. Life is really to short and can end anytime – to precious not be enjoyed. RIP.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.