[R-SIG-Mac] Corrupt R installation
Dr Eberhard Lisse
no@p@m @end|ng |rom ||@@e@NA
Wed Jun 9 10:55:03 CEST 2021
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'
More information about the R-SIG-Mac
mailing list