Difficulty Installing dslabs package in Rstudio

Hello.

I am new to R and Rstudio. I have had troubles trying to install dslabs. After a few tries, I managed to get (apparently) Rtools (Rtools 3.3.0.1959 for RStudio and Rtools4.0 for R) installed for both (different versions, I understood). After some work (and time) I managed to install it in R (v4.0.0) but failed with RStudio Version 1.2.5042.

I keep failing to install dslabs in Rstudio, though.

It's a HP core i7 notebook with windows 10.

This is what looks like in Rstudio console:

install.packages("dslabs")
Installing package into ‘C:/Users/Felipe/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
Warning in install.packages :
package ‘dslabs’ is not available (for R version 3.2.2)

Any hints, please?

Thanks in advance,

Not sure what's going on. CRAN says it Depends on R (≥ 3.1.2), https://cran.r-project.org/web/packages/dslabs/index.html, So you should be fine.

I was just able to install this on a mac with R 3.6.3.

Honestly, whenever I get something like this, my go to resolution is to restart R in the RStudio IDE >> Session >> Restart R. And then retry.

Thanks !

It is funny. R is working fine, but not RStudio. I downloaded the 3.3 version of Rtools (according to CRAN should be good for 3.2.x).

I tried to restart R, as you told, but still does not work.

I decided to recheck ... and realized that Rtools is not working ...

Restarting R session...

Microsoft R Open version 8.0 (64-bit):
Microsoft packages Copyright (C) 2016 Microsoft Corporation

Type 'readme()' for release notes.

install.packages("Rtools")
Installing package into ‘C:/Users/Felipe/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
Warning in install.packages :
package ‘Rtools’ is not available (for R version 3.2.2)

I remember reading somewhere that I should add some PATH, but I am not sure how this would work when you have both (R and Rstudio) installed.

Any hints?

When you are installing packages, they are being installed in the library for R version 3.2. That is what the information in the console tells you in the line Installing package into ‘C:/Users/Felipe/Documents/R/win-library/3.2’. And even though CRAN says R ≥ 3.1.2, from the error message it seems like it does not like version 3.2.2 after all.

It is important to realize that when you update R, it does not overwrite older versions of R (this way you can still use older versions of R, in case packages are not compatible). And your computer creates separate libraries for your packages. You have to make sure RStudio uses the correct version of R!
If you're on a Mac and download a new version of R and then open RStudio, it will automatically use the newest R version. For Windows, you should do this:

  1. Install and load installr : install.packages("installr") and library(installr)
  2. Call updateR() function. This will start the updating process of your R installation by: “finding the latest R version, downloading it, running the installer, deleting the installation file, copy and updating old packages to the new R installation.”
    OR
  3. From within RStudio, go to Help > Check for Updates to install newer version of RStudio (if available, optional).

Once you do this and restart RStudio and R, make sure to check the version of R that is being loaded, and that it is the latest version.
And, you indeed need RTools to download dslabs, since it is not compiled. RTools is not a package, it is a piece of software that you need so you can download and compile binary packages. This does not happen often, most packages are already compiled and you don't need RTools. But I just checked and dslabs is indeed binary.

I would recommend you use the function install.Rtools() from the package installr (same package as above): https://www.rdocumentation.org/packages/installr/versions/0.22.0/topics/install.Rtools
Now you should be able to get dslabs.

1 Like

It worked ! Thank you very much !

It was working well, but windows decided to update, crashed, and I had to restore and older version ...
I checked that the version is OK (Version 1.3.959
© 2009-2020 RStudio, PBC)
I checked if there is any update - no needed.
I checked and updated all installed packages.
And then I tried to run tidyverse ... It gave an error message:

library(tidyverse)
Erro: package or namespace load failed for ‘tidyverse’ in get(Info[i, 1], envir = env):
não foi possível abrir o arquivo 'C:/Users/Felipe/Documents/R/win-library/4.0/dplyr/R/dplyr.rdb': No such file or directory

I tried to execute tour suggestions, but it failed in

library(installr)
Carregando pacotes exigidos: stringr
Error: package or namespace load failed for ‘stringr’ in library.dynam(lib, package, package.lib):
DLL ‘stringi’ not found: maybe not installed for this architecture?
Erro: package ‘stringr’ could not be loaded

Any hints, please?

I decided to give it another try.
Unistalled R, RStudio and RTools.
Looked for and erase all directories "R", "Rtools" and "RStudio" that I found.
Reinstalled everything.
Now it seems to work.
Thanks.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.