I originally posted this on the Stack Overflow site. I understand that it is inappropriate to ask the same question on multiple sites, but they were unable to help and I was told to come here.

I am unable to install the R package ggplot2 because it depends on the package digest, which requires R (>= 3.3.0) and I only have 3.2.3. I tried upgrading R as described here, but I get an unusual message after the first line and an error after the third. The results of the first 3 lines are below exactly as the appear on the command terminal, edited for privacy and empty lines before commands added for clarity.

Name1@Name2 ~ $ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
[sudo] password for Name1: 
Executing: /tmp/tmp.BIQ28xf0ql/gpg.1.sh --keyserver
gpg: requesting key E084DAB9 from hkp server keyserver.ubuntu.com
gpg: key E084DAB9: "Michael Rutter <marutter@gmail.com>" not changed
gpg: Total number processed: 1
gpg:              unchanged: 1

Name1@Name2 ~ $ sudo echo "deb http://cran.wustl.edu/bin/linux/ubuntu xenial/" | sudo tee -a /etc/apt/sources.list
deb http://cran.wustl.edu/bin/linux/ubuntu xenial/

Name1@Name2 ~ $ sudo apt update
E: Malformed entry 2 in list file /etc/apt/sources.list (Suite)
E: The list of sources could not be read.

All commands after the third give the same errors, with commands 4 and 6 giving the errors twice for some reason.

I will be frank and admit that this whole think is very beyond me and I am just copying and pasting the code that supplied without understanding most of it. Any help will be greatly appreciated.

  • 1
    As the error message says, you've a malformed line in /etc/apt/sources.list. Fix the error - or post it in your question if need be – roaima Nov 8 '20 at 21:11

The R repository supports two different versions of R:

  • 3.5 and later and
  • 4.0 and later.

According to your question, you want the first one. Linux Mint 18 is based on Ubuntu Xenial, so its version should be suitable. Then, according to the official manual, you need different line in /etc/apt/sources.list:

deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/

You should be able to edit your /etc/apt/sources.list with a text editor like nano. If using nano, you can open the file for editing with:

sudo nano /etc/apt/sources.list

Navigate to the entry with arrow keys, and correct it, press Ctrl+X, enter y, and hit Enter to save and exit editing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.