0

I want to do supervised classification using the code below t1972_sup<- superclass(t1972, model = "rf", train1972, responseCol = "id", trainPartition = 0.7) However, I need to install RStoobox install.packages("RStoolbox") for my random forest. I cant seem to win with this code and I have tried this writeup here but no win. I have since installed Rtools for R from version 4.0.0 to 4.1.3. I followed through the process Sys.which("make")and getting this > Sys.which("make") make "C:\\rtools40\\usr\\bin\\make.exe" .

When I try again to install RStoolbox, I get this error `> install.packages("RStoolbox") Installing package into ‘D:/Documents/R/win-library/4.1’ (as ‘lib’ is unspecified) Warning in install.packages : package ‘RStoolbox’ is not available for this version of R

A version of this package for your version of R might be available elsewhere, see the ideas at https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages`

Could I be missing something? Please help

I have checked the link https://cran.r-project.org/bin/windows/Rtools/rtools40.html for guiding required RTools before installing RStoolbox on windows.

Bravedo
  • 1
  • 1
  • 1
    It looks like the RStoolbox package was [archived](https://cran.r-project.org/web/packages/RStoolbox/index.html). You could try downloading the [most recent source](https://cran.r-project.org/src/contrib/Archive/RStoolbox/RStoolbox_0.3.0.tar.gz) and installing from the local package. – DaveArmstrong Apr 04 '23 at 16:47
  • @DaveArmstrong, I have downloaded the most recent source you provided and did run the code `install.packages("C:\Users\kondw\Desktop\TimeSeries_Kalomo\RStoolbox", repos = NULL, type = "source")`. I am getting the error: `> install.packages("C:\Users\kondw\Desktop\TimeSeries_Kalomo\RStoolbox", Error: '\U' used without hex digits in character string starting ""C:\U" > repos = NULL, Error: unexpected ',' in " repos = NULL," > type = "source") Error: unexpected ')' in " type = "source")"` – Bravedo Apr 04 '23 at 17:13
  • The problem is that on windows, you need to separate folders on the path with either `\\` or `/` - either will work. For example, you could use: `install.packages("C:\\Users\\kondw\\Desktop\\TimeSeries_Kalomo\\RStoolbox",repos = NULL, type = "source")`, but you may need to point it to the `.tar.gz` archive. – DaveArmstrong Apr 04 '23 at 19:16
  • Running `install.packages("C:\\Users\\kondw\\Desktop\\TimeSeries_Kalomo\\RStoolbox",repos = NULL, type = "source")` and got error ` Installing package into ‘D:/Documents/R/win-library/4.1’ (as ‘lib’ is unspecified) ERROR: dependencies 'caret', 'XML', 'reshape2', 'exactextractr', 'doParallel', 'foreach', 'RcppArmadillo' are not available for package 'RStoolbox' * removing 'D:/Documents/R/win-library/4.1/RStoolbox' Warning in install.packages : installation of package ‘C:/Users/kondw/Desktop/TimeSeries_Kalomo/RStoolbox’ had non-zero exit status` – Bravedo Apr 05 '23 at 12:08
  • It's telling you that you need to install all those dependencies first. Since you've set `repos=NULL` (which is the right thing to do here), the function can't find all the other dependencies. Try this first: `install.packages(c( 'caret', 'XML', 'reshape2', 'exactextractr', 'doParallel', 'foreach', 'RcppArmadillo'))` – DaveArmstrong Apr 05 '23 at 12:11
  • @DaveArmstrong, trying ` install.packages(c( 'caret', 'XML', 'reshape2', 'exactextractr', 'doParallel', 'foreach', 'RcppArmadillo')) ` fails with error ` install.packages(c( 'caret', 'XML', 'reshape2', 'exactextractr', 'doParallel', 'foreach', 'RcppArmadillo')) ` – Bravedo Apr 05 '23 at 12:24
  • It is showing a failure to some directory : `Versions of these packages for your version of R might be available elsewhere, see the ideas at https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages Warning in install.packages : unable to access index for repository https://cran.rstudio.com/bin/windows/contrib/4.1: cannot open destfile 'C:\Users\kondw\AppData\Local\Temp\RtmpkPKThw\file11d05a8d3996', reason 'No such file or directory'` – Bravedo Apr 05 '23 at 12:27
  • Can you try installing each one of those packages independently to see if it is just one that fails? – DaveArmstrong Apr 05 '23 at 13:25
  • Trying these independently too failed. `install.packages("caret") install.packages("XML") install.packages("reshape2") install.packages('doParallel') install.packages("RcppArmadillo")` `Warning in install.packages : unable to access index for repository https://cran.rstudio.com/src/contrib: cannot open destfile 'C:\Users\kondw\AppData\Local\Temp\RtmpkPKThw\file11d03d7650ea', reason 'No such file or directory'` – Bravedo Apr 05 '23 at 13:37
  • Have you tried restarting R and trying again? Aside from that, I'm not sure what could be the problem. – DaveArmstrong Apr 05 '23 at 13:39
  • The installation for dependencies (caret, XML, ...) later worked after several restarts. Weirdly with same code. However, installing RStoolbox `install.packages("RStoolbox")` failed giving an error ` installation of package ‘C:/Users/kondw/Desktop/TimeSeries_Kalomo/RStoolbox’ had non-zero exit status` – Bravedo Apr 06 '23 at 10:37
  • Have you tried installing the package from GitHub? `devtools::install_github("bleutner/RStoolbox")` – DaveArmstrong Apr 06 '23 at 11:53
  • I just tried that and got : ` devtools::install_github("bleutner/RStoolbox")` `Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : namespace ‘rlang’ 1.0.1 is already loaded, but >= 1.0.6 is required' – Bravedo Apr 06 '23 at 21:03
  • Restart R and reinstall the rlang package. Depending on the dependencies for rlang 1.0.6, you may need another strategy, like an older commit on GitHub or upgrading R. – DaveArmstrong Apr 06 '23 at 21:12
  • @DaveArmstrong, thanks a lot for the guide and hints to resolving this. It finally worked using `install.packages("devtools")` , `library(devtools)`, and then running a specific version of RStoolbox (in this case 0.2.6). I used the code `devtools::install_version('RStoolbox', '0.2.6')`. – Bravedo Apr 11 '23 at 12:31

0 Answers0