Thursday, October 28, 2021

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

Issue

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?


Solution

@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.



Answered By - user438383