There is no package called 'foreign' - r

I'm trying to install the package 'Hmisc' in R but I'm running into an error, shown below:
Error: package or namespace load failed for 'Hmisc' in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called 'foreign'
Traceback:
1. library(Hmisc)
2. tryCatch({
. attr(package, "LibPath") <- which.lib.loc
. ns <- loadNamespace(package, lib.loc)
. env <- attachNamespace(ns, pos = pos, deps, exclude, include.only)
. }, 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)
. })
3. tryCatchList(expr, classes, parentenv, handlers)
4. tryCatchOne(expr, names, parentenv, handlers[[1L]])
5. value[[3L]](cond)
6. stop(msg, call. = FALSE, domain = NA)
I've looked around and can't seem to find any answers.

Related

i want to install package "magick" in r (jupyter), but i doesn't work

error
install.package is fine.
But when i write library(magick), i get this error.
I don't understand why it doesn't install.
Another library's works fine.
=====
i write:
install.packages("magick")
library(magick)
i get:
Error: package or namespace load failed for ‘magick’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/srv/rlibs/magick/libs/magick.so':
libMagick++-6.Q16.so.7: cannot open shared object file: No such file or directory
Traceback:
1. library(magick)
2. tryCatch({
. attr(package, "LibPath") <- which.lib.loc
. ns <- loadNamespace(package, lib.loc)
. env <- attachNamespace(ns, pos = pos, deps, exclude, include.only)
. }, 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 && !quietly)
. message(paste("Error:", msg), domain = NA)
. else stop(msg, call. = FALSE, domain = NA)
. })
3. tryCatchList(expr, classes, parentenv, handlers)
4. tryCatchOne(expr, names, parentenv, handlers[[1L]])
5. value[[3L]](cond)
stop(msg, call. = FALSE, domain = NA)

unable to install ggraph package in r

I was trying to install ggraph but is faced with this error. May i know how can i overcome this error? I updated ggplot to 3.0.0 but still the error persists.
Error: package or namespace load failed for 'ggraph':
object 'nest_legacy' is not exported by 'namespace:tidyr'
Traceback:
1. library(ggraph)
2. tryCatch({
. attr(package, "LibPath") <- which.lib.loc
. ns <- loadNamespace(package, lib.loc)
. env <- attachNamespace(ns, pos = pos, deps, exclude, include.only)
. }, 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)
. })
3. tryCatchList(expr, classes, parentenv, handlers)
4. tryCatchOne(expr, names, parentenv, handlers[[1L]])
5. value[[3L]](cond)
6. stop(msg, call. = FALSE, domain = NA)

Why can't install tidymodels package in Jupyter notebook?

My Rstudio is 4.0.4 version, however, it showed that the package was built under R verision 3.6.3.
And I can not use this package. How to solove this problem?
library(tidymodels)
Warning message:
"package 'tidymodels' was built under R version 3.6.3"
Error: package or namespace load failed for 'tidymodels' in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
namespace 'recipes' 0.1.5 is being loaded, but >= 0.1.16 is required
Traceback:
1. library(tidymodels)
2. tryCatch({
. attr(package, "LibPath") <- which.lib.loc
. ns <- loadNamespace(package, lib.loc)
. env <- attachNamespace(ns, pos = pos, deps, exclude, include.only)
. }, 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)
. })
3. tryCatchList(expr, classes, parentenv, handlers)
4. tryCatchOne(expr, names, parentenv, handlers[[1L]])
5. value[[3L]](cond)
6. stop(msg, call. = FALSE, domain = NA)
That's a warning. The actual error shows beneath:
Error: package or namespace load failed for 'tidymodels' in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
namespace 'recipes' 0.1.5 is being loaded, but >= 0.1.16 is required
And it is very clear: you need a more recent version of recipes which you can get through install.packages. It could be that a newer version of the package is not available for your R version, in which case you'll need to install RTools (assuming windows, otherwise not required) and do an installation from source.

How to adjust Jupyter Notebook "R" error?

I'm getting the below error when trying to import library & I'm using R in Jupyter Notebook.
library(ggpubr)
Warning message:
"package 'ggpubr' was built under R version 3.6.3"
Error: package or namespace load failed for 'ggpubr' in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
namespace 'rlang' 0.4.2 is already loaded, but >= 0.4.5 is required
Traceback:
1. library(ggpubr)
2. tryCatch({
. attr(package, "LibPath") <- which.lib.loc
. ns <- loadNamespace(package, lib.loc)
. env <- attachNamespace(ns, pos = pos, deps, exclude, include.only)
. }, 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)
. })
3. tryCatchList(expr, classes, parentenv, handlers)
4. tryCatchOne(expr, names, parentenv, handlers[[1L]])
5. value[[3L]](cond)
6. stop(msg, call. = FALSE, domain = NA)
I have tried the below codes to adjust it ,But it didn't workout
remove.packages("ggpubr")
&
install.packages("ggpubr")
&
update.packages(Yes)

can't load ggmap package in jupyter

I used conda install -c vfonov r-ggmap to install ggmap package. When I tried to load the package in Jupyter notebook, I got the following error:
Error: package or namespace load failed for ‘ggmap’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/anaconda3/lib/R/library/jpeg/libs/jpeg.so':
dlopen(/anaconda3/lib/R/library/jpeg/libs/jpeg.so, 6): Library not loaded: #rpath/libjpeg.9.dylib
Referenced from: /anaconda3/lib/R/library/jpeg/libs/jpeg.so
Reason: Incompatible library version: jpeg.so requires version 13.0.0 or later, but libjpeg.9.dylib provides version 12.0.0
Traceback:
1. library(ggmap)
2. 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)
. })
3. tryCatchList(expr, classes, parentenv, handlers)
4. tryCatchOne(expr, names, parentenv, handlers[[1L]])
5. value[[3L]](cond)
6. stop(msg, call. = FALSE, domain = NA)
I appreciate any help.
The solution is surprisingly easy.
conda install -c conda-forge jpeg
done.

Resources