Anytime I have tried to import a package in R, it ends up crashing. To illustrate, if I run a command such as library(broom)
in my terminal, the following error is yielded:
*** caught segfault ***
address 0x18, cause 'memory not mapped'
Traceback:
1: dyn.load(file, DLLpath = DLLpath, ...)
2: library.dynam(lib, package, package.lib)
3: loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]])
4: namespaceImport(ns, loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]), from = package)
5: loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]])
6: namespaceImport(ns, loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]), from = package)
7: loadNamespace(package, lib.loc)
8: doTryCatch(return(expr), name, parentenv, handler)
9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
10: tryCatchList(expr, classes, parentenv, handlers)
11: tryCatch({ attr(package, "LibPath") <- which.lib.loc ns <- loadNamespace(package, lib.loc) env <- attachNamespace(ns, pos = pos, deps)}, error = function(e) { P <- if (!is.null(cc <- conditionCall(e))) paste(" in", deparse(cc)[1L]) else "" msg <- gettextf("package or namespace load failed for %s%s:\n %s", sQuote(package), P, conditionMessage(e)) if (logical.return) message(paste("Error:", msg), domain = NA) else stop(msg, call. = FALSE, domain = NA)})
12: library(broom)
Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
This error is followed by my R crashing in my terminal. Furthermore, this result replicated within RStudio, and the whole program must be reopened if I try to import packages. Interestingly, not all packages behave the same way. When I import a basic package such as library(stats)
or library(base)
, it works fine.
I have tried to uninstall R, Rstudio, and relevant R packages from my computer and then reinstall them (as per https://support.rstudio.com/hc/en-us/community/posts/115007714568-Latest-version-of-Rstudio-rmarkdown-causing-abort-on-R-version-3-4-0-for-x86-64-apple-darwin15-6-0-64-bit-), but with no success. Is this a problem that is related to the setup of my PATH variable?
For the record, I am running R-3.4 on Mac OSX-10.12 Sierra.
UPDATE
This might not be that important, but I decided to look around and see where my packages were installed by putting them all in a dataframe in R (ip<-as.data.frame(installed.packages())
), and I noticed that my packages are stored in two different file paths– either /Users/bob/Library/R/3.4/library
, or /Library/Frameworks/R.framework/Versions/3.4/Resources/library
. Does anybody think this discrepancy is the cause for my R crashing all the time?