R Tutorial: A Complete Hands-on How To Use Guide For Free
R Tutorial

R Tutorial: A Complete Hands-on How To Use Guide For Free

Last updated on 09th Jul 2020, Blog, Tutorials

About author

Logeshwari (Software Development Engineer )

Logeshwari has over four years of experience as a project estimator. She provides extensive expertise in software development, including design, implementation, debugging, Java, C and C++, C#, asset bundles, 3D math.

(5.0) | 19212 Ratings 1411
  • R Programming Tutorial is designed for both beginners and professionals. Our tutorial provides all the basic and advanced concepts of data analysis and visualization.
  • R is a software environment which is used to analyze statistical information and graphical representation. R allows us to do modular programming using functions.
  • Our R tutorial includes all topics of R such as introduction, features, installation, rstudio ide, variables, data types, operators, if statement, vector, data handling, graphics, statistical modelling, etc. This programming language was named R, based on the first name letter of the two authors (Robert Gentleman and Ross Ihaka).

    Subscribe For Free Demo


    What is R Programming?

    • “R is an interpreted computer programming language which was created by Ross Ihaka and Robert Gentleman at the University of Auckland, New Zealand.” The R Development Core Team currently develops R.
    • It is also a software environment used to analyze statistical information, graphical representation, reporting, and data modeling. R is the implementation of the S programming language, which is combined with lexical scoping semantics.
    • R not only allows us to do branching and looping but also allows us to do modular programming using functions. R allows integration with the procedures written in the C, C++, .Net, Python, and FORTRAN languages to improve efficiency.
    • In the present era, R is one of the most important tools which is used by researchers, data analysts, statisticians, and marketers for retrieving, cleaning, analyzing, visualizing, and presenting data.

    History of R Programming

    The history of R goes back about 20-30 years ago. R was developed by Ross Lhaka and Robert Gentleman in the University of Auckland, New Zealand, and the R Development Core Team currently develops it. This programming language name is taken from the name of both the developers. The first project was considered in 1992. The initial version was released in 1995, and in 2000, a stable beta version was released.


    The following table shows the release date, version, and description of R language:

    Version-Release Date Description
    0.49 1997-04-23 First time R’s source was released, and CRAN (Comprehensive R Archive Network) was started.
    0.60 1997-12-05 R officially gets the GNU license.
    0.65.1 1999-10-07 update.packages and install.packages both are included.
    1.0 2000-02-29 The first production-ready version was released.
    1.4 2001-12-19 First version for Mac OS is made available.
    2.0 2004-10-04 The first version for Mac OS is made available.
    2.1 2005-04-18 Add support for UTF-8encoding, internationalization, localization etc.
    2.11 2010-04-22 Add support for Windows 64-bit systems.
    2.13 2011-04-14 Added a function that rapidly converts code to byte code.
    2.14 2011-10-31 Added some new packages.
    2.15 2012-03-30 Improved serialization speed for long vectors.
    3.0 2013-04-03 Support for larger numeric values on 64-bit systems.
    3.4 2017-04-21 The just-in-time compilation (JIT) is enabled by default.
    3.5 2018-04-23 Added new features such as compact internal representation of integer sequences, serialization format etc.

    Features of R programming

    R is a domain-specific programming language which aims to do data analysis. It has some unique features which make it very powerful. The most important arguably being the notation of vectors. These vectors allow us to perform a complex operation on a set of values in a single command. There are the following features of R programming:

    • It is a simple and effective programming language which has been well developed.
    • It is data analysis software.
    • It is a well-designed, easy, and effective language which has the concepts of user-defined, looping, conditional, and various I/O facilities.
    • It has a consistent and incorporated set of tools which are used for data analysis.
    • For different types of calculation on arrays, lists and vectors, R contains a suite of operators.
    • It provides an effective data handling and storage facility.
    • It is an open-source, powerful, and highly extensible software.
    • It provides highly extensible graphical techniques.
    • It allows us to perform multiple calculations using vectors.
    • R is an interpreted language.

    Why use R Programming?

    • There are several tools available in the market to perform data analysis. Learning new languages is time taken. The data scientist can use two excellent tools, i.e., R and Python. We may not have time to learn them both at the time when we get started to learn data science.
    • Learning statistical modeling and algorithms is more important than to learn a programming language. A programming language is used to compute and communicate our discovery.
    • The important task in data science is the way we deal with the data: clean, feature engineering, feature selection, and import. It should be our primary focus. Data scientist’s job is to understand the data, manipulate it, and expose the best approach. For machine learning, the best algorithms can be implemented with R.
    • Keras and TensorFlow allow us to create high-end machine learning techniques. R has a package to perform Xgboost. Xgboost is one of the best algorithms for Kaggle competition.
    • R communicates with the other languages and possibly calls Python, Java, C++. The big data world is also accessible to R. We can connect R with different databases like Spark or Hadoop.
    • In brief, R is a great tool to investigate and explore the data. The elaborate analysis such as clustering, correlation, and data reduction are done with R.
    • Data science deals with identifying, extracting, and representing meaningful information from the data source. R, Python, SAS, SQL, Tableau, MATLAB, etc. are the most useful tools for data science. R and Python are the most used ones. But still, it becomes confusing to choose the better or the most suitable one among the two, R and Python.
    Course Curriculum

    Get R programming Courses to Build Your Skills & Enhance Your Career

    Weekday / Weekend BatchesSee Batch Details
    Years Description
    1977-1985: In these particular years, the INGRES project is developed. The Ingres Company developed in 1980 and 1994: the computer Associates acquires it.The Ingres project is a proof-of-concept for relational databases.
    1986-1994: POSTGRES In INGRES, upgrading the features is essential for object-orientation and the query language Quel.The codebase of INGRES was not used as a basis for POSTGRES.After that, it is commercialized as Illustrate, which is acquired by Informix and IBM.
    1994-1995: Postgres95 In 1994, support for SQL was added.In 1995, they released as Postgres95.In 1996, they were re-released as PostgreSQL 6.0.The Formation of the PostgreSQL Global Development Team.

    Applications of R

    There are several-applications available in real-time. Some of the popular applications are as follows:

    1. Facebook
    2. Google
    3. Twitter
    4. HRDAG
    5. Sunlight Foundation
    6. RealClimate
    7. NDAA
    8. XBOX ONE
    9. ANZ
    10. FDA
    • Generally, while doing programming in any programming language, you need to use various variables to store various information. Variables are nothing but reserved memory locations to store values. This means that, when you create a variable you reserve some space in memory.
    • You may like to store information of various data types like character, wide character, integer, floating point, double floating point, Boolean etc. Based on the data type of a variable, the operating system allocates memory and decides what can be stored in the reserved memory.
    • In contrast to other programming languages like C and java in R, the variables are not declared as some data type. The variables are assigned with R-Objects and the data type of the R-object becomes the data type of the variable. There are many types of R-objects. The frequently used ones are −
    1. Vectors
    2. Lists
    3. Matrices
    4. Arrays
    5. Factors
    6. Data Frames
    • The simplest of these objects is the vector object and there are six data types of these atomic vectors, also termed as six classes of vectors. The other R-Objects are built upon the atomic vectors.
    Data TypeExampleVerify
    LogicalTRUE, FALSE
    v <- TRUE print(class(v))it produces the following result −[1] “logical” 
    Numeric12.3, 5, 999
    v <- 23.5print(class(v))it produces the following result −[1] “numeric”
    Integer2L, 34L, 0L
    v <- 2Lprint(class(v))it produces the following result −[1] “integer”
    Complex3 + 2i
    v <- 2+5iprint(class(v))it produces the following result −[1] “complex”
    Character‘a’ , ‘”good”, “TRUE”, ‘23.4’
    v <- “TRUE”print(class(v))it produces the following result −[1] “character”
    Raw“Hello” is stored as 48 65 6c 6c 6f
    v <- charToRaw(“Hello”)print(class(v))it produces the following result −[1] “raw” 
    • In R programming, the very basic data types are the R-objects called vectors which hold elements of different classes as shown above. Please note in R the number of classes is not confined to only the above six types. For example, we can use many atomic vectors and create an array whose class will become an array.


    When you want to create a vector with more than one element, you should use c() function which means to combine the elements into a vector.

    • # Create a vector.
    • apple <- c(‘red’,’green’,”yellow”)
    • print(apple)
    • # Get the class of the vector.
    • print(class(apple))

    When we execute the above code, it produces the following result −

    [1] “red”    “green”  “yellow”

    [1] “character”


    • A list is an R-object which can contain many different types of elements inside it like vectors, functions and even another list inside it.
    • # Create a list.
    • list1 <- list(c(2,5,3),21.3,sin)
    • # Print the list.
    • print(list1)
    R Sample Resumes! Download & Edit, Get Noticed by Top Employers! Download

    When we execute the above code, it produces the following result −


    [1] 2 5 3


    [1] 21.3


    function (x)  .Primitive(“sin”)


    A matrix is a two-dimensional rectangular data set. It can be created using a vector input to the matrix function.

    • # Create a matrix.
    • M = matrix( c(‘a’,’a’,’b’,’c’,’b’,’a’), nrow = 2, ncol = 3, byrow = TRUE)
    • print(M)

    When we execute the above code, it produces the following result −

    • [,1] [,2] [,3]

    Are you looking training with Right Jobs?

    Contact Us
    Get Training Quote for Free