Error installing "dslabs" package - warning in install packages: dependency 'ggplot2' is not available

Hi

I have just started an edX course with RStudio, one of the first tasks being to install "dslabs" package.

However, whenever I try to submit the code I receive this error message:

install.packages("dslabs")
Warning in install.packages :
dependency ‘ggplot2’ is not available
Error in readRDS(pfile) :
cannot read workspace version 3 written by R 4.1.3; need R 3.5.0 or newer
Error in install.packages : Error in readRDS(pfile) :
cannot read workspace version 3 written by R 4.1.3; need R 3.5.0 or newer

I have also tried to install "ggplot2" and received this message

install.packages("ggplot2")
Warning in install.packages :
package ‘ggplot2’ is not available (for R version 3.2.1)
Error in readRDS(pfile) :
cannot read workspace version 3 written by R 3.6.3; need R 3.5.0 or newer
Error in install.packages : Error in readRDS(pfile) :
cannot read workspace version 3 written by R 3.6.3; need R 3.5.0 or newer

My RStudio is version: 2022.02.0
The R I have installed is R-3.6.3
I have a MacOS 10.13

Other things I have tried from help I have seen on this site and the response from RStudio:

install.packages(c("dslabs", "tidyverse"))
Warning in install.packages :
package ‘tidyverse’ is not available (for R version 3.2.1)
Warning in install.packages :
dependency ‘ggplot2’ is not available
Error in install.packages : Line starting '<!DOCTYPE HTML PUBLI ...' is malformed!

install.packages("rlang")
Warning in install.packages :
package ‘rlang’ is not available (for R version 3.2.1)
Error in readRDS(pfile) :
cannot read workspace version 3 written by R 3.6.3; need R 3.5.0 or newer
Error in install.packages : Error in readRDS(pfile) :
cannot read workspace version 3 written by R 3.6.3; need R 3.5.0 or newer

I would really appreciate some help because I have just began working with R

You have a very old version of R. The most recent version is R-4.1.3. I would suggest upgrading to it and trying again.

Thanks

I updated to R-4.1.3. and tried again and now I am receiving this message:

install.packages("dslabs")
Warning in install.packages :
dependency ‘ggplot2’ is not available
Error in readRDS(pfile) :
cannot read workspace version 3 written by R 4.1.3; need R 3.5.0 or newer
Error in install.packages : Error in readRDS(pfile) :
cannot read workspace version 3 written by R 4.1.3; need R 3.5.0 or newer

I am guessing here but it looks like you may be loading an old workspace from your earlier installation. When you are exiting R and RStudio, you working environment is saved automatically unless you deliberately say "do not save".

See
?readRDS
?saveRDS

I'd have a look in your default directory and see if you can find and delete any RDS file. If I remember correctly should have an "rds' or " rdata" extension.

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.