In R on Jupyter Notebook: “there is no package called ‘faraway’” - r

I am using R on jupyter notebook
I am trying to learn some commands
I install the package as in
install.packages('faraway', repos='http://cran.us.r-project.org')
The outcome was
also installing the dependencies 'minqa', 'nloptr', 'RcppEigen', 'lme4'
Warning message in install.packages("faraway", repos = "http://cran.us.r-project.org"):
"installation of package 'minqa' had non-zero exit status"
Warning message in install.packages("faraway", repos = "http://cran.us.r-project.org"):
"installation of package 'nloptr' had non-zero exit status"
Warning message in install.packages("faraway", repos = "http://cran.us.r-project.org"):
"installation of package 'RcppEigen' had non-zero exit status"
Warning message in install.packages("faraway", repos = "http://cran.us.r-project.org"):
"installation of package 'lme4' had non-zero exit status"
Warning message in install.packages("faraway", repos = "http://cran.us.r-project.org"):
"installation of package 'faraway' had non-zero exit status"
Updating HTML index of packages in '.Library' Making 'packages.html' ... done
In the terminal I got that
ERROR: dependency ‘lme4’ is not available for package ‘faraway’
* removing ‘/anaconda3/lib/R/library/faraway’
The downloaded source packages are in
‘/private/var/folders/sk/ls5hgt056k72k2yxpm01jct00000gn/T/RtmpZijWPV/downloaded_packages’
[I 07:36:55.974 LabApp] Saving file at /4/Untitled1.ipynb
[E 07:36:55.984 LabApp] Notebook JSON is invalid: Additional properties are not allowed ('execution_count' was unexpected)
Failed validating 'additionalProperties' in error:
On instance['cells'][7]['outputs'][0]:
{'ename': 'ERROR',
'evalue': 'Error in library("minqa"): there is no package called ‘minqa’\n',
'execution_count': 3,
'output_type': 'error',
'traceback': ['Error in library("minqa"): there is no package called '
'‘minqa’\n'
'Tr...',
'1. library("minqa")',
'2. stop(txt, domain = NA)']}
then afterwards
require('faraway')
The outcome was
Loading required package: faraway Warning message in library(package,
lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
“there is no package called ‘faraway’”
also if I command
library('faraway')
Error in library("faraway"): there is no package called ‘faraway’
Traceback:
Is there any advice on this? Thank you

Your first line of code worked for me
install.packages('faraway', repos='http://cran.us.r-project.org')

try this:
conda install -c conda-forge r-faraway

Related

ERROR: lazy loading failed for package ‘omd’

In this question How to install.packages of R 4.2.0?, when I try the code in R
install.packages("devtools")
library("devtools")
install_github("sangwon-hyun/omd", subdir = "omd")
I have tried install goal as the comment on R
install.packages(c('rasterVis', 'rgdal', 'raster', 'sp', 'sf', 'gstat'))
But it still shows that
ERROR: lazy loading failed for package ‘omd’
* removing ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/omd’
Warning message:
In i.p(...) :
installation of package ‘/var/folders/4v/wwrgppgn1s5dqn1mfv457mqm0000gn/T//RtmpJAqJio/fileafc37eeacc4a/omd_0.0.0.9000.tar.gz’ had non-zero exit status

Install Package in Jupyter Notebook, Anaconda

I'm running R language with Jupyter Notebook using Anaconda via Environments - not R Studio.
I'm trying to install R packages but it gives me the following errors:
install.packages('agricolae', repos="http://cran.rstudio.com/")
also installing the dependencies ‘units’, ‘sf’, ‘spdep’
Warning message in install.packages("agricolae", repos = "http://cran.rstudio.com/"):
“installation of package ‘units’ had non-zero exit status”Warning message in install.packages("agricolae", repos = "http://cran.rstudio.com/"):
“installation of package ‘sf’ had non-zero exit status”Warning message in install.packages("agricolae", repos = "http://cran.rstudio.com/"):
“installation of package ‘spdep’ had non-zero exit status”Warning message in install.packages("agricolae", repos = "http://cran.rstudio.com/"):
“installation of package ‘agricolae’ had non-zero exit status”Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Then I try to load the library
library("agricolae")
Error in library("agricolae"): there is no package called ‘agricolae’
Traceback:
library("agricolae")
If I open with R Studio, I can make it work.
Does anybody know how to solve the issue on Jupyter Notebook?, I'm using macOs sierra 10.12.6.
Thank you very much

How should I solve error “there is no package called ‘rspatial’?

I'm trying to install rspatial package using:
if (!require("rspatial")) devtools::install_github('rspatial/rspatial')
but I received below error:
Error: Failed to install 'rspatial' from GitHub:
(converted from warning) installation of package ‘C:/Users/A02243~1/AppData/Local/Temp/Rtmpgx3SZq/file16441e95c6/rspatial_1.0-0.tar.gz’ had non-zero exit status
In addition: Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
there is no package called ‘rspatial’
Also, I used:
install.packages("rspatial")
and I received below warning
Warning in install.packages :
package ‘rspatial’ is not available (for R version 3.5.2)
Is there any other ways that will install rspatial on R version 3.5.2?
Thanks.
3.5.2 has some issues with devtools - try updating processx package and see if that resolves the issue.

Non-zero exit status when attempting to install devtools in R on MacOS

I've been trying to install devtools in R on MacOS, first by using in RStudio:
install.packages("devtools")
and then using as an alternative:
install.packages("devtools",lib="/usr/local/Cellar/r/3.6.0_3/lib/R/library")
This gave permission errors, therefore I then used the terminal:
sudo R
then using the same commands as in RStudio to install the package, which gave me the following error(s) for both commands:
1: In install.packages("devtools", lib = "/usr/local/Cellar/r/3.6.0_3/lib/R/library") :
installation of package ‘xml2’ had non-zero exit status
2: In install.packages("devtools", lib = "/usr/local/Cellar/r/3.6.0_3/lib/R/library") :
installation of package ‘roxygen2’ had non-zero exit status
3: In install.packages("devtools", lib = "/usr/local/Cellar/r/3.6.0_3/lib/R/library") :
installation of package ‘devtools’ had non-zero exit status
I do not have experience using R, and the solutions mentioned online when using Ubunu or CentOS do not work.
Please let me know if you have suggestions on how to install devtools and what is causing these errors, any suggestions are highly appreciated.
Thank you in advance!
Using dependencies=TRUE does a lot more installations, but still gives the following result:
The downloaded source packages are in
‘/private/tmp/RtmptCt93z/downloaded_packages’
Warning messages:
1: In install.packages("devtools", dependencies = TRUE) :
installation of package ‘xml2’ had non-zero exit status
2: In install.packages("devtools", dependencies = TRUE) :
installation of package ‘RCurl’ had non-zero exit status
3: In install.packages("devtools", dependencies = TRUE) :
installation of package ‘rvest’ had non-zero exit status
4: In install.packages("devtools", dependencies = TRUE) :
installation of package ‘roxygen2’ had non-zero exit status
5: In install.packages("devtools", dependencies = TRUE) :
installation of package ‘rversions’ had non-zero exit status
6: In install.packages("devtools", dependencies = TRUE) :
installation of package ‘spelling’ had non-zero exit status
7: In install.packages("devtools", dependencies = TRUE) :
installation of package ‘rsconnect’ had non-zero exit status
8: In install.packages("devtools", dependencies = TRUE) :
installation of package ‘foghorn’ had non-zero exit status
9: In install.packages("devtools", dependencies = TRUE) :
installation of package ‘devtools’ had non-zero exit status
10: In install.packages("devtools", dependencies = TRUE) :
installation of package ‘pkgdown’ had non-zero exit status
I tried manually adding the path shown in RStudio to my .bash_profile, which resulted in my terminal not knowing any commands (sudo, nano, etc) anymore, which way would be the correct one to do this, is maybe the path to R the problem?
> R.home()
[1] "/usr/local/Cellar/r/3.6.0_3/lib/R"
I finally solved it by downloading devtools directly via https://cran.r-project.org/web/packages/devtools/devtools.pdf (as suggested by #NelsonGon)
Then moving that folder to R.home()/library
then running devtools using sudo in the terminal to install github packages.

Error in library("Hmisc"): there is no package called 'Hmisc'

I just installed R using anaconda, and I am following this tutorial:
https://www.analyticsvidhya.com/blog/2016/03/tutorial-powerful-packages-imputing-missing-values/
I learned that I need to install some package by using:
if(!require(Hmisc)) install.packages("Hmisc",repos = "http://cran.us.r-project.org")
There are some warning message i am not sure whether it means successful or not:
Loading required package: Hmisc
Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, : there is no package called 'Hmisc'also installing the dependencies 'survival', 'ggplot2'
Warning message:
In install.packages("Hmisc", repos = "http://cran.us.r-project.org"): installation of package 'survival' had non-zero exit status
Warning message:
In install.packages("Hmisc", repos = "http://cran.us.r-project.org"): installation of package 'ggplot2' had non-zero exit status
Warning message:
In install.packages("Hmisc", repos = "http://cran.us.r-project.org"): installation of package 'Hmisc' had non-zero exit status
The downloaded source packages are in
'/tmp/Rtmpcf6rZ9/downloaded_packages'
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Then I tried to load the library with
library(Hmisc)
But I got the error,
Error in library(Hmisc): there is no package called 'Hmisc'
Does anyone know what might has happened? Thanks.
Edit:
I am suggested to try a few more ways, but they all have various error:
install.packages("Hmisc")
Error in contrib.url(repos, type): trying to use CRAN without setting a mirror
If I do:
install.packages("Hmisc",repos = "http://cran.us.r-project.org")
I got:
also installing the dependencies 'survival', 'ggplot2'
Warning message:
In install.packages("Hmisc", repos = "http://cran.us.r-project.org"): installation of package 'survival' had non-zero exit status
Warning message:
In install.packages("Hmisc", repos = "http://cran.us.r-project.org"): installation of package 'ggplot2' had non-zero exit status
Warning message:
In install.packages("Hmisc", repos = "http://cran.us.r-project.org"): installation of package 'Hmisc' had non-zero exit status
The downloaded source packages are in
'/tmp/Rtmpcf6rZ9/downloaded_packages'
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
I am suggested not to use Anaconda R, but because I mostly use rpy2 and jupiter notebook the most. I think using the Anaconda R may be the most straight forward method to get my jupiter notebook and python to work seamlessly with R.
I had a similar issue, solved it by installing "acepack" directly install.packages('acepack')
This is mysterious, regardless. I do an update of all packages in Conda. Then, I install Rstudio using anaconda. Then the error does not exist anymore...

Resources