Installing caret for R. nlopt linux install error - r

I am new to linux and struggling with installing caret for R. I am receiving the following error during the caret install process.
configure: Need to download and build NLopt
trying URL 'http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz'
Error in download.file(url = "http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz", :
cannot open URL 'http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz'
Execution halted
/bin/gtar: This does not look like a tar archive
gzip: stdin: unexpected end of file
/bin/gtar: Child returned status 1
/bin/gtar: Error is not recoverable: exiting now
Warning message:
In untar(tarfile = "nlopt-2.4.2.tar.gz") :
'/bin/gtar -xf 'nlopt-2.4.2.tar.gz'' returned error code 2
configure: Starting to install library to /tmp/RtmpIT5jNR/R.INSTALL17d113d7c2a/nloptr/nlopt-2.4.2
./configure: line 3325: cd: nlopt-2.4.2: No such file or directory
It stops after this, floating and then I have to crash R to fix it. I have scoured through the nlopt site and based on the error have attempted to install into R manually. I have the actual tar file and I have placed it into Rstudios package file, then gone through the process of installing it. However, this does not seem to work at all. I am guessing there is something specific to R that needs to be done to complete the install?
Note I have tried installing just the nlopt via install.packages and the same error occurs. Any ideas?
Edit 1:
> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS release 6.9 (Final)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] grid stats graphics grDevices utils datasets
[7] methods base
other attached packages:
[1] nnet_7.3-11 Hmisc_3.17-0 Formula_1.2-1
[4] survival_2.38-3 lattice_0.20-33 readxl_0.1.0
[7] reshape2_1.4.1 ggplot2_1.0.1 dplyr_0.4.3
[10] data.table_1.9.6
loaded via a namespace (and not attached):
[1] Rcpp_0.12.2 cluster_2.0.3 magrittr_1.5
[4] splines_3.2.2 MASS_7.3-43 munsell_0.4.2
[7] colorspace_1.2-6 R6_2.1.1 stringr_1.0.0
[10] plyr_1.8.3 tools_3.2.2 parallel_3.2.2
[13] gtable_0.1.2 latticeExtra_0.6-26 DBI_0.3.1
[16] lazyeval_0.1.10 assertthat_0.1 digest_0.6.8
[19] gridExtra_2.0.0 RColorBrewer_1.1-2 acepack_1.3-3.3
[22] rpart_4.1-10 stringi_1.0-1 RevoUtils_8.0.0
[25] scales_0.3.0 foreign_0.8-65 chron_2.3-47
[28] proto_0.3-10
I reconogize I am not using the most recent version of R and unfortunitly will not be able to upgrade. However, Caret package information claims it should work on anything greater than R(>=2.1), lattice(>=0.2) and ggplot2. All of which criteria is met.

Related

devtools::install_github Error: Failed to install 'unknown package' from GitHub

I got error from installing R packages using devtools::install_github
> devtools::install_github('cole-trapnell-lab/leidenbase')
Error: Failed to install 'unknown package' from GitHub:
SSL certificate problem: self signed certificate in certificate chain
I tried a solution posted here
library(httr)
set_config( config( ssl_verifypeer = 0L ) )
But still got the same error. Any suggestions?
sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: Ubuntu precise (12.04.5 LTS)
Matrix products: default
BLAS/LAPACK: /mounts/anaconda3/envs/r-4.0.3/lib/libopenblasp-r0.3.12.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] httr_1.4.2 knitr_1.30 nvimcom_0.9-105
loaded via a namespace (and not attached):
[1] magrittr_2.0.1 usethis_2.0.0 devtools_2.3.2 pkgload_1.1.0 R6_2.5.0
[6] rlang_0.4.10 fansi_0.4.1 tools_4.0.3 pkgbuild_1.2.0 xfun_0.19
[11] sessioninfo_1.1.1 cli_2.2.0 withr_2.3.0 ellipsis_0.3.1 remotes_2.2.0
[16] assertthat_0.2.1 digest_0.6.27 rprojroot_2.0.2 lifecycle_0.2.0 crayon_1.3.4
[21] processx_3.4.5 purrr_0.3.4 callr_3.5.1 fs_1.5.0 ps_1.5.0
[26] curl_4.3 testthat_3.0.1 memoise_1.1.0 glue_1.4.2 compiler_4.0.3
[31] desc_1.2.0 prettyunits_1.1.1
I don't get the ssl error when I run your code, but you could try installing the leidenbase package using remotes::install_github():
#install.packages("remotes")
library(remotes)
install_github('cole-trapnell-lab/leidenbase')
Also it might be worth loading openssl through anaconda, e.g. conda install openssl (might help).

R lme4ord installation error: "Error: object ‘sigma’ is not exported by 'namespace:lme4'"

I am trying to install lme4ord from github and receiving the following error:
remotes::install_github("stevencarlislewalker/lme4ord")
Downloading GitHub repo stevencarlislewalker/lme4ord#master
checking for file ‘/tmp/RtmpngUWJn/remotes2a0c5ce3f7b/stevencarlislewalker-lme4ord-5f62664/DESCRIP✔ checking for file ‘/tmp/RtmpngUWJn/remotes2a0c5ce3f7b/stevencarlislewalker-lme4ord-5f62664/DESCRIPTION’ (625ms)
─ preparing ‘lme4ord’:
✔ checking DESCRIPTION meta-information
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ building ‘lme4ord_0.0-3.tar.gz’
Installing package into ‘/home/localuserdir/R/x86_64-redhat-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
* installing *source* package ‘lme4ord’ ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error: object ‘sigma’ is not exported by 'namespace:lme4'
Execution halted
ERROR: lazy loading failed for package ‘lme4ord’
* removing ‘/home/localuserdir/R/x86_64-redhat-linux-gnu-library/3.6/lme4ord’
Error: Failed to install 'lme4ord' from GitHub:
(converted from warning) installation of package ‘/tmp/RtmpngUWJn/file2a0c7b718e3a/lme4ord_0.0-3.tar.gz’ had non-zero exit status
My sessionInfo is:
R version 3.6.0 (2019-04-26)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Fedora 30 (Workstation Edition)
Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] remotes_2.1.0 lme4_1.1-21 Matrix_1.2-17
loaded via a namespace (and not attached):
[1] Rcpp_1.0.2 magrittr_1.5 splines_3.6.0 MASS_7.3-51.4
[5] lattice_0.20-38 R6_2.4.0 minqa_1.2.4 tcltk_3.6.0
[9] tools_3.6.0 pkgbuild_1.0.3 grid_3.6.0 nlme_3.1-139
[13] cli_1.1.0 withr_2.1.2 assertthat_0.2.1 rprojroot_1.3-2
[17] crayon_1.3.4 processx_3.4.1 nloptr_1.2.1 callr_3.3.1
[21] ps_1.3.0 curl_4.0 compiler_3.6.0 backports_1.1.4
[25] prettyunits_1.0.2 boot_1.3-22
I have seen some discussions of namespace interactions (whether sigma is loaded from base or lme4) in earlier versions (3.2 or less) of R, but everything here should be up to date.
Any ideas?

How to run a package's testthat tests

For a given installed package, how do I run its testthat tests? I'm not a developer of the installed package, I'm a user. I just want to run its test suite to confirm its tests pass in my environment. I've tried test_check and test_package but I see errors.
To be more specific, I know its test suite fails and I want to run the tests in an interactive R session so I can debug it.
> require(eplusr) # choice of package unimportant. Any using testthat will do.
Loading required package: eplusr
> require(testthat)
Loading required package: testthat
> test_check("eplusr")
Error in test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, :
No matching test file in dir
> test_package("eplusr")
Error: No tests found for eplusr
> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.1 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8
[8] LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] testthat_2.0.0 eplusr_0.9.1
loaded via a namespace (and not attached):
[1] Rcpp_0.12.18 magrittr_1.5 units_0.6-0 hms_0.4.2 progress_1.2.0 uuid_0.1-2 bit_1.1-14 debugme_1.1.0 R6_2.2.2 rlang_0.2.2
[11] stringr_1.3.1 blob_1.1.1 tools_3.5.1 data.table_1.11.5 cli_1.0.0 DBI_1.0.0 withr_2.1.2 bit64_0.9-7 assertthat_0.2.0 digest_0.6.16
[21] tibble_1.4.2 crayon_1.3.4 processx_3.2.0 readr_1.1.1 callr_3.0.0 later_0.7.4 base64enc_0.1-3 ps_1.1.0 fasttime_1.0-2 memoise_1.1.0
[31] RSQLite_2.1.1 stringi_1.2.4 pillar_1.3.0 compiler_3.5.1 prettyunits_1.0.2 lubridate_1.7.4 pkgconfig_2.0.2
R doesn't install the testthat tests by default. To do so try :
install.packages('eplusr', INSTALL_opts="--install-tests", type='source')
Then, either:
testthat::test_package('eplusr')
or alternatively using the built-in testInstalledPackage:
tools::testInstalledPackage('eplusr')
You can't (unless you reinstall overriding default behaviour as shown in Brodie's answer).
It's a design flaw^Hchoice. testthat, in all its wisdom, decided to not install tests by default by enforcing the placement in the tests/ directory. R offers an option to override it (as shown) which is generally not turned on. Hence the dilemma.
Of course, RUnit did it correctly all along having tests below inst/. So if a package uses RUnit you can run its tests once installed. Without having to reinstall it.
Edit: 1 1/2 years later, many of us now use the tinytest package which arrived within the last year. Among other advantages, also allows very easy testing of installed packages.

How to install multicore package on R v3.1.2?

I am using default command to install multicore package
install.packages('multicore','http://www.rforge.net/')
as written here http://www.rforge.net/multicore/files/ but I recieve warning:
install.packages('multicore','http://www.rforge.net/')
Warning in install.packages :
'lib = "http://www.rforge.net/"' is not writable
Would you like to use a personal library instead? (y/n) y
Warning in install.packages :
package ‘multicore’ is not available (for R version 3.1.2)
Does anybody know any solution to this? I can not use previous versions of R.
I would like to use mclapply function from that package.
Thanks for help.
My session info is:
> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-redhat-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] stringi_0.4-1 ggplot2_1.0.0
loaded via a namespace (and not attached):
[1] colorspace_1.2-4 digest_0.6.8 grid_3.1.2 gtable_0.1.2
[5] MASS_7.3-35 munsell_0.4.2 plyr_1.8.1 proto_0.3-10
[9] Rcpp_0.11.3 reshape2_1.4.1 scales_0.2.4 stringr_0.6.2
[13] tools_3.1.2
Why do you need it?
Most of its functionality has been integrated into the parallel package which already comes with R. Have a look at its vignette, eg from within R via vignette() or else from here.
And the reason you cannot install 'multicore' is because it has been withdrawn by R Core, given how its functionality is (essentially entirely) in 'parallel' now.

melting data.table seems to crash RStudio?

After a bit of googling and stalking stackoverflow, I think I may have stumbled onto a bug with the reshape2 package (or data.table, I'm not sure). Specifically, I am unable to melt a particular data.table of mine.
Here's a reproducible example (you can find a copy of that particular .Rdata file here):
library(data.table)
library(ggplot2)
library(reshape2)
load("mpi_cv_vanilla_random_gov_17h55--100_class_widths.Rdata")
melt(par.grid.results)
Before I run melt, my usessionInfo is as follows:
> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: i686-pc-linux-gnu (32-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] reshape2_1.2.2 ggplot2_0.9.3.1 data.table_1.8.10
loaded via a namespace (and not attached):
[1] colorspace_1.2-4 dichromat_2.0-0 digest_0.6.4 grid_3.0.2
[5] gtable_0.1.2 labeling_0.2 MASS_7.3-29 munsell_0.4.2
[9] plyr_1.8 proto_0.3-10 RColorBrewer_1.0-5 scales_0.2.3
[13] stringr_0.6.2 tools_3.0.2
And once I run melt(par.grid.results), RStudio throws up the picture of the bomb with dialogue:
"R Session Aborted \nR encountered a fatal error \nThe session was terminated".
If anyone has any ideas as to what's going on, I'd love to hear them.
Thanks!
Edit: Running this inside the terminal, I get the following error (segfault):
> melt(par.grid.results)
Using as id variables
*** caught segfault ***
address 0x18, cause 'memory not mapped'
Traceback:
1: unlist(unname(data[var$measure]))
2: melt.data.frame(par.grid.results)
3: melt(par.grid.results)
Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace

Resources