インストール/アンインストール R3.5 on Ubuntu 16.04LTS

Precondition

  • This is in my case of install R3.5, So It's like a log.
  • I use Ubuntu 16.04LTS.
NAME="Ubuntu"
VERSION="16.04.5 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.5 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial

Installation

1. Add an bellow entry in /etc/apt/sources.list file
  • Notice that https is not available in default in my enviroment.
  • In this case, you need install apt-transport-https to solve this problem.
deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/
2. If you had old one e.g. after uninstall old one, you should remove apt package lists.
$ sudo rm -rf /var/lib/apt/lists
3. Install the complete R system
$ sudo apt-get update
$ sudo apt-get install r-base
4. Confirm the version
$ R
R version 3.5.1 (2018-07-02) -- "Feather Spray"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

Uninstallation

1. Uninstall R-packages.
  • uninstall include removing configuration files.
$ sudo apt-get purge r-base
  • remove any packages that are no longer needed.
$ sudo apt-get autoremove