Re: [R-SIG-Mac] Corrupt R installation
Um, this is actually a lot easier purely with R - if you want to keep track of your favorite packages it is as simple as pkgs = rownames(installed.packages()) writeLines(pkgs, "packages.txt") and oyu have a list of all packages that you can edit if desired. if you ever want to re-install then simply pkgs = readLines("packages.txt") install.packages(pkgs) and if you only want to install missing it's simply missing.pkgs = pkgs[!pkgs %in% rownames(installed.packages())] install.packages(missing.pkgs) All trivially done in R. It is always beyond me why people come up with incredibly convoluted solutions to simple things .. Cheers, Simon > On 9/06/2021, at 8:55 PM, Dr Eberhard Lisse wrote: > > On 08/06/2021 22:46, moleps islon wrote: > [...] >> I have no idea why, but my R installation (Mac OS X - Big Sur) >> automatically updates causing havoc with my libraries each time. My >> Mac is under administration from the university and their software >> center, but they claim it is not their fault - but I still suspect >> them for causing all the trouble. > [...] > > Sounds like Homebrew to me. If so, or anyway, create a file (before > updating) which contains something like > >#!/usr/bin/env Rscript --vanilla ># ># set the Mirror ># >local({ > r <- getOption("repos") >r["CRAN"] <- "https://cloud.r-project.org/; > options(repos = r) >}) >install.packages(c( > "lubridate", > "tidyverse" >), dependencies = TRUE) > > > or similar and run it if the additional libraries disappear. > > You can fill this with something like > >grep -h library *R \ >|awk -F 'library' '{print $2}' \ >|sed 's/(//g;s/)//g' \ >|sort -u \ >|awk '{print "\"" $1 "\","}' >|sed '$ s/,$//' > > or in a few lines of the language of your choice generate the whole > script. And of course refine to your liking with something like > >find ~/R -name '*.R' -exec grep -h library {} ';' \ >... > > greetings, el > > -- > To email me replace 'nospam' with 'el' > > ___ > R-SIG-Mac mailing list > R-SIG-Mac@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-mac ___ R-SIG-Mac mailing list R-SIG-Mac@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-mac
Re: [R-SIG-Mac] Corrupt R installation
Besides that Homebrew does not explain any chaos and does not do a fragile mess, he clearly stated that his installation is managed/controlled by his University, so the below isn't helpful. See my other response in this thread about how to automagically re-install packages after Homebrew updates. el On 09/06/2021 02:07, Simon Urbanek wrote: You seem to have entirely non-standard setup that you're on your own and I assume you're not using CRAN R since you involve homebrew (which explains the chaos) so presumably you re-compiled R yourself and all packages, but I'd like to point out that if all you are after is OpenMP support then you don't need any of that fragile mess as explained at https://mac.r-project.org/openmp/ Cheers, Simon On 9/06/2021, at 8:46 AM, moleps islon wrote: [...] I have no idea why, but my R installation (Mac OS X - Big Sur) automatically updates causing havoc with my libraries each time. My Mac is under administration from the university and their software center, but they claim it is not their fault - but I still suspect them for causing all the trouble. [...] -- To email me replace 'nospam' with 'el' ___ R-SIG-Mac mailing list R-SIG-Mac@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-mac
Re: [R-SIG-Mac] Corrupt R installation
On 08/06/2021 22:46, moleps islon wrote: [...] I have no idea why, but my R installation (Mac OS X - Big Sur) automatically updates causing havoc with my libraries each time. My Mac is under administration from the university and their software center, but they claim it is not their fault - but I still suspect them for causing all the trouble. [...] Sounds like Homebrew to me. If so, or anyway, create a file (before updating) which contains something like #!/usr/bin/env Rscript --vanilla # # set the Mirror # local({ r <- getOption("repos") r["CRAN"] <- "https://cloud.r-project.org/; options(repos = r) }) install.packages(c( "lubridate", "tidyverse" ), dependencies = TRUE) or similar and run it if the additional libraries disappear. You can fill this with something like grep -h library *R \ |awk -F 'library' '{print $2}' \ |sed 's/(//g;s/)//g' \ |sort -u \ |awk '{print "\"" $1 "\","}' |sed '$ s/,$//' or in a few lines of the language of your choice generate the whole script. And of course refine to your liking with something like find ~/R -name '*.R' -exec grep -h library {} ';' \ ... greetings, el -- To email me replace 'nospam' with 'el' ___ R-SIG-Mac mailing list R-SIG-Mac@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-mac