'Completely remove R and its files in Linux mint

I was having trouble with R packages so I decided to uninstall to do fresh install. Now I cannot even re-install R. I am using Linux Mint. what I did is:

Removed all directories found with .libPaths() And in the terminal: sudo apt-get remove r-base-core sudo apt-get remove r-base sudo apt-get autoremove

Now when I try to install R following https://cran.r-project.org/ tutorial, I get many errors:

sudo apt update -qq
E: The repository 'https://cloud.r-project.org/bin/linux/ubuntu una-cran40/ Release' does not have a Release file.


apt install --no-install-recommends r-base
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-recommended (= 3.6.3-2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.


apt install r-recommended
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-recommended : Depends: r-cran-foreign (>= 0.7-2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.


apt install r-cran-foreign
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-cran-foreign : Depends: r-base-core (>= 4.0.0-1.2004.0) but 3.6.3-2 is to be installed
                  Depends: r-api-4.0 but it is not installable
E: Unable to correct problems, you have held broken packages.


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source