Error Installing R on Ubuntu 18 Broken Packages

I'm really struggling with installing R on Ubuntu 18. It's my first time with the OS... I tried looking up other questions here in the website and had no luck, even with this on that is basically my problem: Dependency errors while installing R in Ubuntu 17.10

Anyway, I tried running sudo apt install r-base and the response is:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 r-base : Depends: r-base-core (>= 3.4.4-1xenial0) but it is not going to be installed
          Depends: r-recommended (= 3.4.4-1xenial0) but it is not going to be installed
          Recommends: r-base-html but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

And no instruction I've seen here or in any other site seems to correct this issue... If anyone could help me I'd be so grateful! Thanks.


I found what was wrong in another post... this one: How do I restore the default repositories?
It seems some code I used from another forum just ended up messing my repositories I guess? Sorry I asked for help when I just needed to do more research :P

So what I did was:

  • run the following code: sudo rm /etc/apt/sources.list
  • then: sudo -i software-properties-gtk

Go to software-properties-gtk (run it in the console) and reset the repository to the one closest to me (geographically):

Should look like this

and then just reset the update configs to whatever suits you I guess, I put all to automatically update daily.

Then I just ran sudo apt-get intall r-base in and it worked!
Credit to the original post I mentioned earlier.