Install R, R Studio and R Packages in Simple Steps

1. Objective – Install R

This blog is all about R Installation. In this blog, we will understand how to install R. Moreover, we will also learn how to install R packages and R studio for R programming. At last, we will discuss how to update R, R Studio and R packages in simple steps? Here, complete steps are given for easy learning of R installation.

So, let’s the tutorial to Install R.

Install R

Install R, R Studio and R Packages in Simple Steps

R Quiz

2. How to Install R, R Studio, and R Packages?

Here we will discuss the simple steps to install R for R programming. Before installing R, we have to install R Studio. So let’s now learn R Studio installation.

i. How to Install RStudio?

We have to follow three basic steps in the same order to run R and R Studio on your system.

  • First, Install R
  • Install RStudio
  • Install R Packages

Learn: R Hadoop Integration

a. Install R

In respect to the operating system we are using we have to follow the below mentioned steps:
For Mac

  • Download the appropriate version of .pkg file form the following link.
  • Open the downloaded .pkg file and Install R.

Now, for Linux

  • For Ubuntu with Apt-get installed, execute sudo apt-get install r-base in terminal.

For Windows

  • Download the binary setup file for R from the following link.
  • Open the downloaded .exe file and Install R.

b. Install R Studio

Choose the appropriate installer file for your operating system, download it and then run it to install R-studio.

c. Install the R Packages (Optional)

In R Studio, R requires a particular package/library to be installed if we need to use. We can follow the instructions below to do so:

  • Run R studio
  • Click on the Packages tab in the bottom-right section and then click on install. The following dialog box will appear
  • In the Install Packages dialog, write the package name you want to install under the Packages field and then click install. This will install the package you searched for or give you a list of matching package based on your package text.

So, this was the installation procedure for R Studio.
Learn: R Studio | The Best RStudio Tutorial of 2018

ii. Updating R and R Studio

a. Updating R

Updating on Windows

A package called the installer, which is only for Windows can be used to ease the process. Updating on windows is tricky.
If you don’t have installr package then first install it.

# installing/loading the package:
if(!require(installr)) {
} #load / install+load installr

Now call updateR() function to call update.
So, this will start the updating process of your R installation.

Updating on Mac and Ubuntu

One Mac and Ubuntu you need to go to the CRAN website, to install the newer package installer.

b. Updating R Studio

Updating RStudio is easy, go to Help > Check for Updates to install a newer version.

c. Updating R Packages

If you are not aware of R packages, then follow our R packages tutorial for more understanding.

Updating Out of date Packages

Install.packages is used to install update out of data package and is easy with the update.packages() function.
Which will ask you for every package if you want to update, to say yes to everything use ask = FAlSE
update.packages(ask = FALSE)
Unfortunately this won’t update packages installed by devtools::install_github()

Updating all Packages after R update

By using package installr we can handle it on windows.
But for other operating systems, after updating R, a lot of packages might have been build under the old R version. It would be safer to re-install all the packages already installed. This can be done with the following commands. Again this won’t update packages installed with devtools::install_github().

## get packages installed
packs =[1]), stringsAsFactors = F)
## and now re-install install packages using install.packages()

Now, let us see how to install R Packages

Learn: R Packages Tutorial | Learn to Install & Use the Packages in R

iii. R Packages(Libraries)

Packages are collections of R functions, data, and compiled code in a well-defined format. The directory where packages are stored is called the library. R comes with a standard set of packages. Others are available for download and installation. If we will install it once, Once we have to be load it into the session to be used.

a. Recommended Packages

  • In packages, we use many R functions, free libraries of code written by R’s active user community.
  • Open an R session and type at the command line to install an R package.
install.packages("<the package's name>")
  • R package will be downloaded from CRAN.

There are thousands of helpful R packages for you to use, but navigating them all can be a challenge. 

b. Basic Notions

The R Language

  • Statistical computations are carried from R computer Language.
  • R was created by Robert Gentleman and Ross Ihaka at the University of Auckland.
  • It has now evolved into a featured tool for carrying out statistical.

The R Project

  • The R Project is an international collaboration of researchers in statistical computing.
  • There are roughly 20 members of the “R Core Team” who maintain and enhance R.
  • Releases of the R environment are made through the CRAN (comprehensive R archive network) twice per year.
  • The software is released under a “free software” license. Which makes it possible for anyone to download and use it.
  • There are over 3500 extension packages that have been contributed to CRAN.

Basic R Concepts

  • R is a computer language which is processed by a special program called an Interpreter.
  • The interpreter indicates that it is expecting input by printing its prompt at the start of a line. By default, the R prompt is a greater than sign >.
  • On UNIX or LINUX machines we can start R by typing the command “ R ” to a command interpreter prompt in a terminal window.
  • Better yet, we can run R within an Emacs window by typing M-x R.

Basic interaction with R Console

  • The most common form of interaction with R is through the command line at the console
  • User types a command
  • Presses the ENTER key
  • R “returns” the answer
  • It is also possible to store a sequence of commands in a file. Use .R extension and then ask R to execute all commands in the file. .R extension.
  • We may also use the console as a simple calculator.

Using R as a Calculator

  • Users type expressions to the R interpreter.
  • R responds by computing and printing the answers.

> 1 + 2
[1] 3
> ½
[1] 0.5
> 17^2
[1] 289

Any Doubt yet on how to install R? Please comment.
Learn:10 Best Big Data Analytics Tools for 2018

c. Documentation

Documentation is one of the most important aspects of a good package. Without it, users won’t know how to use your package. Documentation is also useful for future-you, and for developers extending your package.

  • Object documentation is a type of reference documentation. It works like a dictionary.
  • Object documentation is helpful if you already know the name of the object.

d. Datasets

Standard test datasets help us to practice and get better at machine learning. Most of them are hosted for free on the UCI Machine Learning Repository.
This last point is critical when practicing machine learning because:

  • We can download them fast.
  • Datasets can fit them into memory.
  • We can run algorithms on them.

So, this was all on how to install R tutorial and install Rstudio and Packages

3. Conclusion: How to Install R

Hence, we have learned how to Install R and R Studio. Moreover, we discussed the updating procedure of R and R Studio. Also, we looked at R Packages. Now you can refer R internals like R Data types, R Functions, R Packages etc to play with R. Still, you have any question about how to install R, feel free to ask through comments. We will try our best to help you.

See Also-

Reference for R 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.