## R Tutorial

We present you the R Tutorial, to learn R language, where we cover the basics of R programming, loading data into R object from different data sources, creating charts and graphs, extracting statistical information, and more.

### What is R programming language ?

R is an open source programming language. In recent times, it has become one of the most common choice for statistical analysis.

### Features of R

- Open Source and Free to use.
- Works well for statistics.
- Command-Line Programming Language – But IDEs like R Studio and plugins to the popular IDEs like Eclipse, etc., are available.
- Easy sharing of Results or Analysis.
- Integration with other packages and programming languages.
- R programming is easy and informative.

## R Tutorial Index

In our R Tutorial, we shall take you through the following topics.

### Get Started with R

The following tutorials help you get started with R programming in your PC or Mac.

### R Variables and Datatypes

Variables deal with how data is stored during program execution and the Datatypes deal with the characteristics of these variables.

### R Operators

R Arithmetic Operators, R Relational Operators, R Logical Operators, R Assignment Operators, R Miscellaneous Operators with example R scripts.

### R Decision Making

Decision Making statements are those which execute a block of code based on the result of a condition. Decision making statements are also called Condition Statements.

In the following R Tutorials, we first go through the available decision making statements in R language: if, if-else, if-else-if and switch; and then go through each of these statements, discuss their syntax and go through examples to understand their usage.

**If Statement with Logical Operators in Condition**

### R Looping

Looping statements are used to execute a block of code repeatedly in a loop, based on a condition, or for every element in a collection.

The following R Tutorials start with different looping statements in R language; and continue with each looping statement in detail with examples.

### R Functions

A function is a set of statements, that can take some arguments, transform them or perform a specific task. R has a large number of in-built functions that cover statistics, basic mathematics, graphs/charts, etc. We can also create our own functions.

### R Strings

String is a sequence of characters.

In the following R Tutorials, we first have a good look into Strings in R programming, and then go through different String Operations with examples.

### R Data Frames

R Data Frames are tightly coupled collections of variables. Data Frames share many of the properties of matrices and of lists. In most of the R language’s modeling software, Data Frames are used as the fundamental data structure.

The following list of R Tutorials help us get started with Data Frames in R, and most used operations or transformation done on Data Frames.

- R Data Frame
- R – Access Element at (i,j) in Data Frame
- R – Create Empty Data Frame
- R – Create Data Frame
- R – Add Column to Data Frame
- R – Reset Row Numbers of Data Frame
- R – Replace NA with 0 in Data Frame
- R – Rename Column(s) of Data Frame
- R – Delete Duplicate Rows in Data Frame
- R – Remove Row(s) in Data Frame
- R – Remove NA Rows in DataFrame
- R – Delete Column(s) in Data Frame
- R – Sort Data Frame by Column
- R – Apply Function For Each Row in Data Frame
- R – Filter Data Frame with NA rows
- R – Convert List to Data Frame
- R – Convert Data Frame to Matrix
- R – Convert Matrix to Data Frame
- R – Combine Data Frames
- R – Compare Data Frames
- R – Import Excel to Data Frame
- R – Structure of Data Frame
- R – Summary of Data Frame

### R Type Conversion

R allows us to convert a value from one datatype to other.

The following R Tutorials go through different scenarios of converting value of a datatype into value of another datatype.

### R Vectors

R Vector is a sequence of elements of same datatype.

The following tutorials give us an introduction to Vectors in R, take us through different type of vectors, basic CRUD operations on a vector, vector conversion, etc.

- R Vectors
- R – Create Vector
- R – Get Vector Length
- R – Access Items in Vector
- R – Iterate over Items of Vector
- R – Sort Vectors
- R – Reverse Vector
- R – Check if Specific Item is present in Vector
- R – Logical Vectors
- R – Integer Vectors
- R – Double Vectors
- R – Character Vectors
- R – Get Type of Vector
- R – Check if type of Vector is Logical
- R – Check if type of Vector is Integer
- R – Check if type of Vector is Double
- R – Check if type of Vector is Character
- R – Convert Logical Vector into Integer Vector
- R – Convert Character Vector into Integer Vector

### R Lists

R List is a sequence of elements. The elements could be of different datatypes.

The following tutorials discuss about basic CRUD operations on a List, accessing properties of a List, different transformations on a List, etc.

- R – Lists
- R – Create Empty List
- R – Create List
- R – Get List Length
- R – Append Item to List
- R – Loop through Items in List
- R – Check if Specific Item is present in List
- R – Reverse List
- R – Join Lists

### R Matrix

The following tutorials cover the basic CRUD operations of a Matrix, mathematic operations like addition, subtraction, multiplication, matrix operations like finding Inverse, Transpose, etc.

- R Matrix
- R – Create Matrix
- R – Check if R Object is a Matrix
- R – Get Element at Given Row, Column of Matrix
- R – Get Specific Row of Matrix
- R – Get Specific Column of Matrix
- R – Get Multiple Rows of Matrix
- R – Get Multiple Columns of Matrix
- R – Matrix Multiplication
- R – Transpose Matrix
- R – Inverse Matrix
- R – Correlation Matrix

### R Date & Time

### Data Interfacing from different sources of data to R language

The following tutorials deal with reading different file types and loading data from those files into R data objects, and how to write data from R objects to files.

### Charts, Plots & Graphs – R Tutorial

The following R Tutorials take us through different plots that we can draw in R language, and how to tweak them with the help of examples.

#### R plot()

- R – Draw Plot from two Vectors X, Y
- R – Draw Line Plot
- R – Change Color of Plot
- R – Set Plot Line Width or Thickness
- R – Set Plot Title
- R – Set X, Y axes Labels

#### R barplot()

- R Bar Plot – From Matrix
- R Bar Plot – Set Main Title
- R Bar Plot – Set X, Y axes Labels
- R Bar Plot – Set Width for Bars
- R Bar Plot – Set Space between Bars
- R Bar Plot – Set Color for Bars
- R Bar Plot – Set Names for Bars
- R Bar Plot – Draw without Axes
- R Bar Plot – Set Border Color for Bars
- R Bar Plot – With Horizontal Bars

### Statistical Analysis

The following list presents different R Tutorials to perform statistical analysis on R objects like Vector, List, Data Frame, Matrix, etc.

### R Mathematical Functions

R has builtin functions that implement Mathematical functions like finding absolute value, finding maximum value of a collection, finding minimum value of a collection, finding square root of a number, etc. The following tutorials help us through these Mathematical functions with examples.

### References

You may refer following reference for official R documentation.

- https://www.rdocumentation.org/

### Conclusion

With this R Tutorial, we have learnt the basics of R, how to interface data to R from different sources, create charts and graphs, and extract statistical information.