我正在使用 Ubuntu 20.04.3 LTS。我使用的是 R 版本 3.6.3。其中没有某些软件包。因此我需要 R 版本 4. 或高于 4. 我尝试了这些操作:
sudo -H gedit /etc/apt/sources.list
然后我添加了此行:deb http://cran.rstudio.com/bin/linux/ubuntu focal/
然后
sudo apt-get update
和sudo apt-get install r-base
但它不起作用。有人能帮帮我吗?
答案1
在 Ubuntu 上安装 R 的指南已经涵盖了这一点,我尝试了该命令,它似乎给出了 R 4.0。结果apt-cache policy
。
$ apt-cache policy r-base
r-base:
Installed: (none)
Candidate: 4.1.1-1.1804.0
Version table:
4.1.1-1.1804.0 500
500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
4.1.0-1.1804.0 500
500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
4.0.5-1.1804.0 500
500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
4.0.4-1.1804.0 500
500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
4.0.4-1build1 500
500 https://mirror.gi.co.id/ubuntu hirsute/universe amd64 Packages
4.0.3-1.1804.0 500
500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
4.0.2-1.1804.0 500
500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
4.0.1-1.1804.0 500
500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
4.0.0-1.1804.0 500
500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
3.4.4-1ubuntu1 500
500 https://mirror.gi.co.id/ubuntu bionic/universe amd64 Packages
以下说明取自R 安装指南。
wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc
sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"
sudo apt update
sudo apt install --no-install-recommends r-base