Installation R
The default source software in general is not the official version of the latest version, install the latest version of the software you need to add the source.
Open R official website , then click on the Download R for Linux => Ubuntu / => the README.html .
Add Key
sudo apt install apt-transport-https software-properties-common
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
gpg --keyserver keyserver.ubuntu.com --recv-key E298A3A825C0D65DFD57CBB651716619E084DAB9
gpg -a --export E298A3A825C0D65DFD57CBB651716619E084DAB9 | sudo apt-key add -
Add source software
(Choose your own system version) sudo vim /etc/apt/sources.list
deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/
Or use the command to add
sudo add-apt-repository 'deb http://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/'
Installation R
sudo apt update
sudo apt upgrade
sudo apt install r-base
Users who need to compile R packages from source [e.g. package maintainers, or anyone installing packages with install.packages()] should also install the r-base-dev package:
sudo apt-get install r-base-dev
Installation RStudio
To RStudio official website to download the latest version installed.