Can't install caret package in R - r

I have tried multiple ways to install the caret package in R.
The error message that I receive is as follows:
Error: package or namespace load failed for ‘caret’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘dimRed’
When I try to install dimRed, I get the following message:
Installing package into ‘C:/Users/Thomas/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
Warning in install.packages :
dependency ‘Biobase’ is not available
There is a binary version available but the source version is later:
binary source needs_compilation
dimRed 0.1.0 0.2.1 FALSE
installing the source package ‘dimRed’
trying URL 'https://cran.rstudio.com/src/contrib/dimRed_0.2.1.tar.gz'
Content type 'application/x-gzip' length 363025 bytes (354 KB)
downloaded 354 KB
ERROR: dependency 'Biobase' is not available for package 'dimRed'
* removing 'C:/Users/Thomas/Documents/R/win-library/3.4/dimRed'
In R CMD INSTALL
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-34~1.4/bin/x64/R" CMD INSTALL -l "C:\Users\Thomas\Documents\R\win-library\3.4" C:\Users\Thomas\AppData\Local\Temp\RtmpqKhsKn/downloaded_packages/dimRed_0.2.1.tar.gz' had status 1
Warning in install.packages :
installation of package ‘dimRed’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\Thomas\AppData\Local\Temp\RtmpqKhsKn\downloaded_packages’
Per previous posts, I have updated RStudio. I have attempted an install from install_url.
Any suggestions are welcome.

I was able to figure this out.
Simply typing install.packages won't work. In order to install Biobase, you have to run the following code in R console:
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("Biobase", version = "3.8")
More info: https://bioconductor.org/packages/release/bioc/html/Biobase.html
Once this step is done, I installed caret again using
install.packages("caret",dependencies = T)
And then it worked.

Warning ...
install.packages("BiocManager")
This only works if your R version is >= 3.5.0
for info I've the same problem under a Centos and a Windows.
issue solved on the windows with 3.5.1 R version. Not yet solved on the centOS (3.4.2)

Related

Is it possible to use package semPlot with R 3.6.2?

I upgraded R to version 3.6.2 and have discovered that package semPlot will not work. It installs without any problems, but when I try to load it I get the message,
Error: package or namespace load failed for ‘semPlot’ in
loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck =
vI[[j]]): there is no package called ‘ggm’
I then tried to install ggm but get the following warning and error:
Warning in install.packages : dependency ‘graph’ is not available
There is a binary version available but the source version is
later:
binary source needs_compilation ggm 2.3 2.5 FALSE installing the source package ‘ggm’ trying URL
'https://cran.rstudio.com/src/contrib/ggm_2.5.tar.gz' Content type
'application/x-gzip' length 109414 bytes (106 KB) downloaded 106 KB
ERROR: dependency ‘graph’ is not available for package ‘ggm’ removing
‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/ggm’
Warning in install.packages : installation of package ‘ggm’ had
non-zero exit status"
I then tried to install graph, but it says:
package ‘graph’ is not available (for R version 3.6.2).
I wondered if anyone else had experienced this problem, and had any solutions so I can load semPlot with R 3.6.2?
Many thanks.
I also have R 3.6.2 and get all errors you get. But when I try to install the semPlot package from GitHub, it works fine, as follows:
install.packages('devtools')
library(devtools)
install_github('SachaEpskamp/semPlot', dependencies = T)
library(semPlot)
Please not that I tried the cran/semPlot repository but didn't work for me, whereas SachaEpskamp/semPlot does.
Hope you get it working.

Different version of GlobalOptions package in R

I'm trying to install the package "circlize" and I am having trouble resolving what seems to be a simple error.
When I run:
install.packages("circlize")
It says:
Installing package into ‘*file location*/3.2’
(as ‘lib’ is unspecified)
Warning in install.packages :
dependency ‘GlobalOptions’ is not available
There is a binary version available but the source version is later:
binary source needs_compilation
circlize 0.3.10 0.4.3 FALSE
installing the source package ‘circlize’
trying URL 'https://mirrors.sorengard.com/cran/src/contrib/circlize_0.4.3.tar.gz'
Content type 'application/x-gzip' length 2456906 bytes (2.3 MB)
downloaded 2.3 MB
* installing *source* package 'circlize' ...
** package 'circlize' successfully unpacked and MD5 sums checked
** R
** demo
** inst
** preparing package for lazy loading
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
namespace 'GlobalOptions' 0.0.11 is being loaded, but >= 0.0.12 is required
ERROR: lazy loading failed for package 'circlize'
* removing '*file location*/3.2/circlize'
Warning in install.packages :
running command '"*file location*/x64/R" CMD INSTALL -l "*file location*\3.2" *file location*/downloaded_packages/circlize_0.4.3.tar.gz' had status 1
Warning in install.packages :
installation of package ‘circlize’ had non-zero exit status
The downloaded source packages are in
‘*file location*\downloaded_packages’
These parts seem most relevant to me:
dependency ‘GlobalOptions’ is not available
namespace 'GlobalOptions' 0.0.11 is being loaded, but >= 0.0.12 is required
When I run sessionInfo() I see under "other attached packages": [1] GlobalOptions_0.0.11
My best guess is that I have the wrong version of GlobalOptions -- I see that GlobalOptions v0.0.13 is available here, but being new to R, I'm not sure what to do now to get the right version up and running.
I'd really appreciate if someone could tell me where I should look next. (I looked through the documentation within that link, but I'm still lost about what to do now.) Thanks!
If you have R version >=3.3.0 you should
install GlobalOptions_0.0.13 from CRAN
install.packages("GlobalOptions")
quit and restart R
re-install circlize from source as before.
If you have an older R version, update R to a more recent version first.

backports 1.1.1 package fails to install

I am unable to public my R notebook. When I try to publish, I get the following error:
Console~/
Console
R Markdown
.../R Test 1/Fall Programming with R Test 1.Rmd
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
there is no package called 'backports'
Calls: :: ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted
I tried to install backports, but it doesn't seem to work either. I get this error when I try to install backports:
> install.packages("backports")
Installing package into ‘C:/Users/agdpa/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
There is a binary version available but the source version is later:
binary source needs_compilation
backports 1.1.0 1.1.1 FALSE
installing the source package ‘backports’
trying URL 'https://cran.rstudio.com/src/contrib/backports_1.1.1.tar.gz'
Content type 'application/x-gzip' length 10090 bytes
downloaded 10090 bytes
* installing *source* package 'backports' ...
** package 'backports' successfully unpacked and MD5 sums checked
** libs
*** arch - i386
Warning: running command 'make -f "C:/PROGRA~1/R/R-34~1.1/etc/i386/Makeconf" -f "C:/PROGRA~1/R/R-34~1.1/share/make/winshlib.mk" SHLIB="backports.dll" OBJECTS="dotsElt.o dotsLength.o init.o"' had status 127
ERROR: compilation failed for package 'backports'
* removing 'C:/Users/agdpa/Documents/R/win-library/3.4/backports'
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-34~1.1/bin/x64/R" CMD INSTALL -l "C:\Users\agdpa\Documents\R\win-library\3.4" C:\Users\agdpa\AppData\Local\Temp\Rtmp8IcAL2/downloaded_packages/backports_1.1.1.tar.gz' had status 1
Warning in install.packages :
installation of package ‘backports’ had non-zero exit status
I'm getting a similar error with the backports R package. It's preventing the devtools package from installing a customised package which I've written.
I fixed it by installing the previous version of backports:
require(devtools)
install_version("backports", version = "1.1.0")
I solved it reinstalling Rtools (I'm running of Windows).

Warning in install.packages : installation of package ‘igraph’ had non-zero exit status

I want to install phyloseq from BioConductor. When I do so, and try to load it, I get an error about igraph (even though I set dependencies to be TRUE). I have tried installing igraph independently, and that is also not working, with non-zero exit status.
I am using RStudio
R version 3.4.0 (2017-04-21)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: OS X El Capitan 10.11.6
Does anyone have any advice? Errors are pasted below.
Thank you for your help!
Here is my command:
install.packages("phyloseq", dependencies = TRUE)
Here is the warning:
Warning in install.packages :
dependency ‘igraph’ is not available
Here I try to load the package I want: library("phyloseq")
Here is the warning: Error:
package or namespace load failed for ‘phyloseq’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]). there is no package called ‘igraph’
Here I try to install igraph directly: install.packages("igraph", dependencies = TRUE)
Here is the compilation failure:
ERROR: compilation failed for package ‘graph’ Warning in install.packages : installation of package ‘igraph’ had non-zero exit status
Open a new terminal and type:
xcode-select --install
I went to the developer page of igraph and downloaded the package into my r library folder. For whatever reason, r does not pull igraph into the library folder when called on the command line so you have to do it manually. Shout out to my prof who showed me how to do this.

unable to install packages("caret") completely in R version 3.2.3

> require("caret")
Loading required package: caret
Loading required package: lattice
Loading required package: ggplot2
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
there is no package called ‘pbkrtest’
So I found that there is lack of "pbkrtest" then I tried to reinstall it.
> install.packages("pbkrtest")
Installing package into ‘C:/Users/ADMIN/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
There is a binary version available but the source version is
later:
binary source needs_compilation
pbkrtest 0.4-2 0.4-3 FALSE
installing the source package ‘pbkrtest’
trying URL 'https://rweb.crmda.ku.edu/cran/src/contrib/pbkrtest_0.4- 3.tar.gz'
Content type 'application/x-gzip' length 164415 bytes (160 KB)
downloaded 160 KB
* installing *source* package 'pbkrtest' ...
** package 'pbkrtest' successfully unpacked and MD5 sums checked
** R
** data
** inst
** preparing package for lazy loading
Warning: replacing previous import by 'stats::sigma' when loading 'pbkrtest'
Error : object 'sigma' is not exported by 'namespace:stats'
ERROR: lazy loading failed for package 'pbkrtest'
* removing 'C:/Users/ADMIN/Documents/R/win-library/3.2/pbkrtest'
The downloaded source packages are in
‘C:\Users\ADMIN\AppData\Local\Temp\Rtmpk7mJT0\downloaded_packages’
Warning messages:
1: running command '"D:/R-3.2.3/bin/x64/R" CMD INSTALL -l
"C:\Users\ADMIN\Documents\R\win-library\3.2"
C:\Users\ADMIN\AppData\Local\Temp\Rtmpk7mJT0/downloaded_packages/pbkrtest_0.4- 3.tar.gz' had status 1
2: In install.packages("pbkrtest") :
installation of package ‘pbkrtest’ had non-zero exit status
It seems like that the installation keeps failing.
As a result, I couldn't use other code using caret packages.
I faced this problem as well on Windows 7. I did following steps in the sequence and it worked.
a) Make sure your R version is updated latest R release 3.2.3
b) The default sources seems to be installing Unix version. So I manually downloaded https://cran.r-project.org/web/packages/pbkrtest/index.html for windows
c) Use manually install function from R menu to install the package.
Cheers,
Ratan
Check version of R by typing version in your console.
If version is not "version.string R version 3.3.2" or later then
Install new version of R from https://cran.r-project.org/bin/windows/base/
Update R version using Tools => Global Options in RStudio.
install package using "install.packages("caret")" in your console.
do require(caret).
test using ?createDataPartition.

Resources