1

I updated my system from ubuntu 18.04 to 18.10. everything worked fine on my previous version, but updating removed all my R libraries.

I want to reinstall them, but when I try and install anything, i.e.

install.packages("data.table")
Installing package into ‘/home/sam/R/x86_64-pc-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
trying URL 'http://cran.revolutionanalytics.com/src/contrib/data.table_1.11.8.tar.gz'
Content type 'application/octet-stream' length 3262853 bytes (3.1 MB)
==================================================
downloaded 3.1 MB

Error in library(ggplot2) : there is no package called ‘ggplot2’
Execution halted

The downloaded source packages are in
    ‘/tmp/RtmpYnxoaQ/downloaded_packages’
Warning message:
In install.packages("data.table") :
  installation of package ‘data.table’ had non-zero exit status

I get some error about ggplot2 not being present, even though i'm not trying to install it. Currently I haven't managed to isntall any libraries.

I am using R version 3.5.1 (2018-07-02) -- "Feather Spray". which is the most recent version.

Any idea why this is happening?

7
  • 1
    No, idea. Is this a vanilla R session without any loading of old work spaces or Rprofile.site (or similar configuration) file? Commented Dec 10, 2018 at 15:15
  • It looks like R is trying to install dependecies which it can't find. You seem to use a different repo than me (it works on my Ubuntu machine). Can you try install.packages("data.table", repos = "https://cloud.r-project.org")? Commented Dec 10, 2018 at 15:17
  • @Roland Actually I didn't know what vanilla R is, normally I just hit 'R' in the terminal and go from there. But I just tried starting R --vanilla and the packages installed properly. But when I go back into just starting with 'R', the same errors appear Commented Dec 10, 2018 at 15:21
  • 1
    So, R was loading something at start-up as I suspected. Find the file that is loaded and look at its content. Commented Dec 10, 2018 at 15:23
  • 2
    Search your system for the files Rprofile.site, .Rprofile, and .Rdata. (I've rarely used R from a linux command line.) Commented Dec 10, 2018 at 15:33

3 Answers 3

1

@Roland was correct - the issue here was that I was trying to load libraries from my .Rprofile that weren't installed. Removing these lines from the .Rprofile stopped the error message.

Sign up to request clarification or add additional context in comments.

Comments

0

You need to update your R version and do this but you'll need install all packages again:

Tool > Global Options > R version (CHANGE) > Select "Use your machine's default version of R..."

Comments

0

I did two things and it's work. Hopefully, it does for you also

  1. a) Update your R and do this.
    Tool > Global Options > R version (CHANGE) > Select "Choose the specific version of R...". Mostly just choose the latest version.
    b) Restart your app after.

  2. Install ggplot2 using this command:

install.packages("ggplot2", dependencies = TRUE)  
library(ggplot2)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.