What happened to testthat? - r

I don't remember having any problems with this, but seemingly suddenly, I can't install any packages because testthat is not there to pass tests. As a catch-22, I can't install testthat either, because it's not there to pass its tests.
R version 3.0.1 (2013-05-16) -- "Good Sport"
Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
Error in library(testthat) : there is no package called 'testthat'
[Previously saved workspace restored]
>
> install.packages("testthat")
Installing package into '/home/user/R/x86_64-pc-linux-gnu-library/3.0'
(as 'lib' is unspecified)
--- Please select a CRAN mirror for use in this session ---
Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 14: reading configurations from ~/.fonts.conf is deprecated.
trying URL 'http://cran.cs.wwu.edu/src/contrib/testthat_0.8.1.tar.gz'
Content type 'application/x-gzip' length 40777 bytes (39 Kb)
opened URL
==================================================
downloaded 39 Kb
Error in library(testthat) : there is no package called 'testthat'
Calls: source -> withVisible -> eval -> eval -> library
Execution halted
The downloaded source packages are in
'/tmp/RtmpMoaIPO/downloaded_packages'
Warning message:
In install.packages("testthat") :
installation of package 'testthat' had non-zero exit status
Is there a way to bypass testing for one install run or otherwise work around this so I can fix my R install?

I live somewhere with poor internet, and I didn't want to download a new version of R and all its dependencies to fix this problem. So you can install an old version of testthat manually:
http://cran.r-project.org/src/contrib/Archive/testthat/
On version 3.0.2, testthat version 0.8.1 seems to work. Once you have downloaded the gzip file, do:
R CMD INSTALL testthat_0.8.1.tar.gz

If you are using linux, you don't have to manually download the package, installing the dependency( in this case 'testthat') via your default manager will also work. I have ubuntu 14.04 and R 3.0.2
sudo apt-get install r-cran-testthat
After running the above command I was able to finally install swirl.

For the record, a full update fixed this, but I don't know why.

Related

installation of package ‘rmarkdown’ had non-zero exit status - How to solve that?

I am trying to install ‘rmarkdown’ in my RStudio Version 1.4.904 and R version 4.0.3 but getting the following error. I cannot open a new rmarkdown and knit a rmarkdown file. Every time I try, this message pops up,
R Markdown documents requires an updated version of the rmarkdown package. Do you want to install this package now?
Can anyone help me with that?
install.packages(ç, dependencies=TRUE)
Installing package into ‘/Users/Library/R/4.0/library’
(as ‘lib’ is unspecified)
There is a binary version available but the source version is later:
binary source needs_compilation
rmarkdown 2.3 2.4 FALSE
installing the source package ‘rmarkdown’
trying URL 'http://cran.utstat.utoronto.ca/src/contrib/rmarkdown_2.4.tar.gz'
Content type 'application/x-gzip' length 3202546 bytes (3.1 MB)
==================================================
downloaded 3.1 MB
Warning in file(con, "r") :
cannot open file '/var/db/timezone/zoneinfo/+VERSION': No such file or directory
dyld: lazy symbol binding failed: Symbol not found: _utimensat
Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libR.dylib (which was built for Mac OS X 10.13)
Expected in: /usr/lib/libSystem.B.dylib
dyld: Symbol not found: _utimensat
Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libR.dylib (which was built for Mac OS X 10.13)
Expected in: /usr/lib/libSystem.B.dylib
/Library/Frameworks/R.framework/Resources/bin/INSTALL: line 34: 30112 Done echo 'tools:::.install_packages()'
30113 Abort trap: 6 | R_DEFAULT_PACKAGES= LC_COLLATE=C "${R_HOME}/bin/R" $myArgs --no-echo --args ${args}
Warning in install.packages :
installation of package ‘rmarkdown’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/70/lgr12kdn6wn_k36sscnc0_dw0000gn/T/Rtmpmc0jUR/downloaded_packages’```
download the binary tgz (https://cran.r-project.org/web/packages/rmarkdown/index.html) and install directly from it.
It should work. I had pretty much the same issue and I solved it that way. Keep me posted!
F
I also faced a similar problem and I spent a half-day on getting the correct solution.
Step I followed:
Uninstalled the existing version
Installed updated version of R - R version 4.0.4 (2021-02-15).
Clicked on File->New file->R markdown. It asked to install Rmarkdown packages.
Noted the packages I need to install
Typed install.packages("rmarkdown", dependencies = TRUE) on R source(can be done on R console)
Then I tried installing Rmarkdown packages individually and it worked for me. Below are the packages I needed to install.
install.packages('knitr')
install.packages('tinytex')
install.packages('base64enc')
install.packages('digest')
install.packages('jsonlite')
install.packages('htmltools')
install.packages('rmarkdown')
A somewhat more technical workaround but it worked for me.
Go to https://cran.r-project.org/ select "Packages" from the menu on the right and navigate until you find the package you need.
Download the binary.zip file for your operating system and extract the files.
Copy the extracted folder into the installation directory for your packages. It should be shown somewhere in the error messages from where you attempted to install the package originally. Replace any existing files. Restart RStudio to recognize the updated versions.

Error in library(ggplot2) : there is no package called ‘ggplot2’ Execution halted

I updated my system from ubuntu 18.04 to 18.10. everything worked fine on my previous version, but updating removed all my R libraries.
I want to reinstall them, but when I try and install anything, i.e.
install.packages("data.table")
Installing package into ‘/home/sam/R/x86_64-pc-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
trying URL 'http://cran.revolutionanalytics.com/src/contrib/data.table_1.11.8.tar.gz'
Content type 'application/octet-stream' length 3262853 bytes (3.1 MB)
==================================================
downloaded 3.1 MB
Error in library(ggplot2) : there is no package called ‘ggplot2’
Execution halted
The downloaded source packages are in
‘/tmp/RtmpYnxoaQ/downloaded_packages’
Warning message:
In install.packages("data.table") :
installation of package ‘data.table’ had non-zero exit status
I get some error about ggplot2 not being present, even though i'm not trying to install it. Currently I haven't managed to isntall any libraries.
I am using R version 3.5.1 (2018-07-02) -- "Feather Spray". which is the most recent version.
Any idea why this is happening?
#Roland was correct - the issue here was that I was trying to load libraries from my .Rprofile that weren't installed. Removing these lines from the .Rprofile stopped the error message.
You need to update your R version and do this but you'll need install all packages again:
Tool > Global Options > R version (CHANGE) > Select "Use your machine's default version of R..."
I did two things and it's work. Hopefully, it does for you also
a) Update your R and do this.
Tool > Global Options > R version (CHANGE) > Select "Choose the specific version of R...". Mostly just choose the latest version.
b) Restart your app after.
Install ggplot2 using this command:
install.packages("ggplot2", dependencies = TRUE)
library(ggplot2)

Installation of RQuantLib

I tried to install RQuantLib from RStudio, but it has given me problems.
I updated my R version to 3.3.1 and tried to use the usual way of installing a package (install.packages("RQuantLib")) as recommended on the webpage of the author (http://dirk.eddelbuettel.com/code/rquantlib.html). However, it gave the following error message :
Warning in install.packages :
package ‘RQuantLib’ is not available (for R version 3.3.1)
I tried installing it on different computers too, but I got the same error message.
Does anyone else experience the same problem or has any idea what could have gone wrong? Thank you!
You are on Windows per your comment. As per this section of the README.md
Windows Binaries
Starting with release 0.4.3, binaries are provided via the ghrr drat repo and can be installed as
R> drat::addRepo("ghrr") # maybe use 'install.packages("drat")' first
R> install.packages(RQuantLib)
you can install a pre-built Windows binaries -- which I just updated for QuantLib 1.8.1 -- from this non-CRAN repo.
Edit: Apparently one now has to say type="binary" even on Windows. Here is a log from a virtual machine I keep:
R> drat::addRepo("ghrr")
R> options("repos")
$repos
CRAN ghrr
"https://cloud.r-project.org" "https://ghrr.github.io/drat/"
R> install.packages("RQuantLib", type="binary")
Installing package into c:/opt/R-library
(as lib is unspecified)
trying URL 'https://ghrr.github.io/drat/bin/windows/contrib/3.3/RQuantLib_0.4.3.zip'
Content type 'application/zip' length 7993848 bytes (7.6 MB)
downloaded 7.6 MB
package RQuantLib successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\[redacted]\AppData\Local\Temp\RtmpAHvBmo\downloaded_packages
R>
I'll update the README.md web page.

Installation of package ‘rjags’ had non-zero exit status

S.O.: Linux Ubuntu 14.04 LTS
R: R version 3.2.1 (2015-06-18) -- "World-Famous Astronaut"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: i686-pc-linux-gnu (32-bit)
When I try to install the package rjags, I get the following fatal error:
install.packages("rjags")
Installing package into ‘/home/marco/.rkward/library’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
trying URL 'http://mirrors.softliste.de/cran/src/contrib/rjags_3-15.tar.gz'
Content type 'application/x-gzip' length 66879 bytes (65 KB)
==================================================
downloaded 65 KB
* installing *source* package ‘rjags’ ...
** package ‘rjags’ successfully unpacked and MD5 sums checked
checking for prefix by checking for jags... no
configure: error: "Location of JAGS headers not defined. Use configure arg '--with-jags-include' or environment variable 'JAGS_INCLUDE'"
ERROR: configuration failed for package ‘rjags’
* removing ‘/home/marco/.rkward/library/rjags’
The downloaded source packages are in
‘/tmp/RtmpditLat/downloaded_packages’
Warning message:
In install.packages("rjags") :
installation of package ‘rjags’ had non-zero exit status
Apparently, the first error message is
configure: error: "Location of JAGS headers not defined. Use configure arg '--with-jags-include' or environment variable 'JAGS_INCLUDE'"
How can I solve this?
As a top comment explained, you need JAGS (Just Another Gibbs Sampler) to be installed in your system. Since you're using Ubuntu 14.04, running
sudo apt-get install jags
should be enough. However, in case you're in another distribution (or, for some reason, the code above doesn't work for you), it's a good idea to know how to get JAGS from the source:
Access http://mcmc-jags.sourceforge.net/
Look for the proper version under "Downloads". For instance, Fedora users should look into the Fedora_20 folder of http://download.opensuse.org/repositories/home:/cornell_vrdc/
Don't forget to download both the base as well as the devel versions.
After the installation is successful, you can go back to R (which can stay open during the whole thing, anyway) and install the package you want.
To me, first, I worked with the installation jags by terminal:
sudo apt-get install jags
and then
install.packages("rjags")
And the error was gone.
1) If necessary Download and install R (https://www.r-project.org/) and potentially a user interface to R like R Studio (see here for tips on getting started with R).
2) Download and install JAGS as per operating system requriements. (http://mcmc-jags.sourceforge.net/)
3) Install additional R packages: e.g., in R install.packages("rjags") . In particular, I use the packages rjags to interface with JAGS and coda to process MCMC output.

Why can't I install the XML package

Am I making some basic error here?
install.packages("XML")
Warning in install.packages :
package ‘XML’ is not available (for R version 2.13.0)
Installing package(s) into ‘C:/Program Files/R/R-2.13.0/library’
(as ‘lib’ is unspecified)
Warning in install.packages :
package ‘XML’ is not available (for R version 2.13.0)
It is probably because www.omegahat.org doesn't exist anymore. So,
command install.packages("XML", repos = "http://www.omegahat.org/R")
does not work. Instead use below:
install.packages("XML", repos = "http://www.omegahat.net/R")
There can be two conditions when you see such error:
The package does not exist in the library (you should install it
from it's own library)
The package is not compatible with your R
version (you should change your R version that is compatible, if you
can afford it)
For the first condition, search on internet and read about the package you want to install and check the provider and repository (for this case, XML, it is official R package)
For the second condition, you can find the information in the following link:
http://cran.r-project.org/web/packages/XML/index.html
you can check your R version by typing the following command into your R shell:
version
which will give you all the information, for e.g:
_
platform x86_64-apple-darwin10.8.0
arch x86_64
os darwin10.8.0
system x86_64, darwin10.8.0
status
major 3
minor 0.1
year 2013
month 05
day 16
svn rev 62743
language R
version.string R version 3.0.1 (2013-05-16)
nickname Good Sport
First update the R-core:
version
install.package('installr')
library(installr)
updateR()
Then install the XML module:
install.packages("XML")
What worked for me is downloading the old release of the XML package and installing from the package archive
install.packages("~/R/win-library/3.6/XML_3.99-0.3.zip", repos = NULL, type = "win.binary").

Resources