You can just install the R-base package using the following code or Use your package manager to install R and R-studio.
apt-get install r-base
(as superuser)
or
sudo apt-get install r-base
Next comes installing RStudio. To install RStudio, go to download RStudio, click on the download button for the RStudio desktop, click the link for the latest R version for your OS, and save the .deb file.
Download the correct version of R-Studio from https://www.rstudio.com/products/rstudio/download/#download
apt install -f ./filename.deb
(as superuser)
Step – 1: Go to the CRAN R project website.
Step – 2: Click on the Download R for Windows link.
Step – 3: Click on the base subdirectory link or install R for the first-time link.
Step – 4: Click Download R X.X.X for Windows (X.X.X stands for the latest version of R. eg: 3.6.1) and save the executable .exe file.
Step - 5: Run the .exe file and follow the installation instructions.
Step – 1: With R-base installed, let’s move on to installing RStudio. To begin, go to download RStudio and click on the download button for the RStudio desktop.
Step – 2: Click on the link for the Windows version of RStudio and save the .exe file.
Step – 3: Run the .exe and follow the installation instructions.
To install R and RStudio on Mac OS X, go through the following steps:
Step – 1: Go to CRAN R Project Website.
Step – 2: Click the Download for (Mac) OS X link.
Step – 3: Click on the link for the pkg file of the latest R version and save it.
Step – 4: Double-click the downloaded file and follow the installation instructions.
Step – 1: With the r-base installed, you must install RStudio. To do that, go to download RStudio and click on the download button for the RStudio desktop.
Step – 2: Click on the link for the Mac OS X version of RStudio and save the .dmg file.
Step – 3: Double-click the downloaded file and then drag and drop it into your applications folder.