问题
Very recently I shifted to Ubuntu from Windows and downloaded R-base (3.4.4) and R studio. However, some packages (car, ROCR etc) were not available and hence I tried to update R. Because of error messages, I finally tried to uninstall and remove R and then install it again.
I tried
sudo apt-get upgrade
sudo apt install r-base
However, it is showing me error message like,
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.2.20200221-1~ubuntu18.04.1~ppa1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
So basically right now, I have no R-base installed.
I tried to remove R-base.
sudo apt-get remove r-base
And all I am getting is-
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'r-base' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
I am a beginner in both R and Linux. I need your valuable suggestions. Thanks in advance.
回答1:
If you are using Ubuntu 18.04, please follow these steps if you are using your local machine of your own. (If your are working in any office environment please setup proxy and follow these steps)
1) Let’s first add the relevant GPG key
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
2) Add the R Repository
sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/'
3) Update Package Lists
sudo apt update
4) Install R
sudo apt install r-base
5) Test Install
sudo -i R
6) Installing R Packages from CRAN
install.packages('dplyr')
来源:https://stackoverflow.com/questions/62166039/having-difficulty-with-re-installing-r-in-ubuntu-18-04