1

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
keyserver.ubuntu.com
--recv-keys
E298A3A825C0D65DFD57CBB651716619E084DAB9
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.

EDIT: Answer available here.

E Tam
  • 148
  • 6

1 Answers1

3

You are almost there, but it seems like your sources.list may be malformed. First delete all entries related to R by using nano /etc/apt/sources.list (or your favorite editor).

Then as you did add the key $ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9

Then add the correct repository sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/'

Quick update sudo apt update

Install r-base by sudo apt-get install r-base

And confirm everything is working with R --version

Hong Ooi
  • 56,353
  • 13
  • 134
  • 187
mhovd
  • 3,724
  • 2
  • 21
  • 47
  • When I open nano, there is no text (outside of the normal interface) and at the bottom it says [ New File ]. I also ran a search through my file system for any folder called "etc" and nothing significant came up. I assumed that whatever I was suppose to delete didn't exist, so I went on to the rest of the steps. When I got to "sudo apt update" I got the same error messages as before. – E Tam Nov 08 '20 at 10:12
  • 1
    Then you should first create the file by doing `touch /etc/apt/sources.list`, and then proceed like I outlined above. – mhovd Nov 08 '20 at 13:15
  • I ran that line of code put nothing happened. The terminal gave no output and there still is no file with that name – E Tam Nov 08 '20 at 14:17
  • 1
    Then I don't know what is wrong, I'm sorry. For the purposes of _this_ site the answer is probably as good as it can be while still being on track. I recommend you ask at a sister-site; https://askubuntu.com/. – mhovd Nov 08 '20 at 15:54
  • Okay, I'll head over there and see if they can help me. – E Tam Nov 08 '20 at 20:33
  • @ETam , you probably missed adding sudo before nano /etc/apt/sources.list, so that to open the file for editing with system administrator privileges. That's why it opened a blank file for you. – Roman Riabenko Nov 08 '20 at 21:54