R Tutorial | Learn R Programming Language
R is an interpreted programming language widely used for statistical computing, data analysis and visualization. R language is open-source with large community support. R provides structured approach to data manipulation, along with decent libraries and packages like Dplyr, Ggplot2, shiny, Janitor and more.
Hello World Program in R Language
Here is an example of the first Hello World program in R Programming Language. To print in R language you just need to use a Print function.
# Code
print("Hello World!")
Output
Hello World! R-Basics
- Introduction to R Programming Language
- Interesting Facts about R
- R vs Python
- How to Install R Studio on Windows and Linux?
- Creation and Execution of R File in R Studio
- Hello World in R Programming
Fundamentals of R
Variables
Input and Output
- Taking Input from User
- Printing Output of R Program
- Print the Argument to the Screen – print() Function
Data Structures
Introduction to Data Structures
Vectors
- Introduction to Vectors
- Operations on Vectors
- Append Operation on Vectors
- Dot Product of Vectors
- Types of Vectors
- Assigning Vectors
- Length of Vectors – length() Function
- Creating a Vector of sequenced elements – seq() Function
- Get Min and Max element of a Vector – range() Function
- Formatting Numbers and Strings – format() Function
- Replace the Elements of a Vector – replace() Function
- Sorting of a Vector – sort() Function
- Convert elements of a Vector to Strings – toString() Function
- Extracting Substrings from a Character Vector – substring() Function
Lists
- Introduction to Lists
- Two Dimensional List
- Operations on Lists
- List of Vectors
- List of Dataframes
- Named List
- Check if the Object is a List – is.list() Function
- Convert an Object to List – as.list() Function
- Apply a Function over a List of elements – lapply() Function
- Operations on Multiple Lists simultaneously – mapply() Function
Matrices
- Introduction to Matrices
- Create Matrix from Vectors
- Operations on Matrices
- Matrix Multiplication
- Algebraic Operations on a Matrix
- Combining Matrices
- Matrix Transpose
- Inverse of Matrix
- Working with Sparse Matrices
- Check if the Object is a Matrix – is.matrix() Function
- Convert an Object into a Matrix – as.matrix() Function
- Get or Set Dimensions of a Matrix – dim() Function
- Calculate Cumulative Sum of a Numeric Object – cumsum() Function
- Compute the Sum of Rows of a Matrix or Array – rowSums Function
>>> More Functions on Matrices
DataFrames
- Introduction to Data Frames
- Matrix vs Dataframe
- DataFrame Operations
- DataFrame Manipulation
- Joining of Dataframes
- The Factor Issue in a DataFrame
- Data Reshaping
- Creating a Data Frame from Vectors
- Data Wrangling – Data Transformation
- Data Wrangling – Working with Tibbles
- Melting and Casting
- Subsetting of DataFrames
- Handling Missing Values
- Convert an Object to Data Frame – as.data.frame() Function
- Get the number of columns of an Object – ncol() Function
- Get the number of rows of an Object – nrow() Function
- Get Addition of the Objects passed as Arguments – sum() Function
- Create Subsets of a Data frame – subset() Function
>>> More Functions on DataFrames
Arrays
- Introduction to Arrays
- Multidimensional Array
- Array Operations
- Sorting of Arrays
- Convert values of an Object to Logical Vector – as.logical() Function
- Performing different Operations on Two Arrays – outer() Function
- Intersection of Two Objects – intersect() Function
- Get Exclusive Elements between Two Objects – setdiff() Function
Factors
- Introduction to Factors
- Level Ordering of Factors
- Convert Factor to Numeric and Numeric to Factor
- Check if a Factor is an Ordered Factor – is.ordered() Function
- Convert Unordered Factor to Ordered Factor – as.ordered() Function
- Checking if the Object is a Factor – is.factor() Function
- Convert a Vector into Factor – as.factor() Function
Strings
- Introduction to Strings
- Working with Text
- String Manipulation
- Concatenate Two Strings
- String Matching
- How to find a SubString?
- Finding the length of string – nchar() method
- Adding elements in a vector – append() method
- Convert string from Lowercase to Uppercase – toupper() function
- Convert String from Uppercase to Lowercase – tolower() method
- Splitting Strings – strsplit() method
- Print a Formatted string – sprintf() Function
Decision Making
Control Flow
- Introduction to Control Statements
- Loops (for, while, repeat)
- For loop
- while loop
- Repeat loop
- goto statement
- Break and Next statements
- Next Statement
Functions
- Introduction to Functions
- Function Arguments
- Types of Functions
- Recursive Functions
- Conversion Functions
Object Oriented Programming
- Introduction to Object-Oriented Programming
- Classes
- Objects
- Encapsulation
- Polymorphism
- Inheritance
- Abstraction
- Looping over Objects
- Creating, Listing, and Deleting Objects in Memory
- S3 class
- Explicit Coercion
- R6 Classes
- Getting attributes of Objects – attributes() and attr() Function
- Get or Set names of Elements of an Object – names() Function
- Get the Minimum element of an Object – min() Function
- Get the Maximum element of an Object – max() Function
>>> More Functions on R Objects
File Handling
- Introduction to File Handling
- Reading Files
- Writing to Files
- Read Lines from a File – readLines() Function
- Working with Binary Files
Packages in R
- Introduction to Packages
- dplyr Package
- ggplot2 package
- Grid and Lattice Packages
- Shiny Package
- tidyr Package
- What Are the Tidyverse Packages?
- Data Munging
Data Interfaces
- Data Handling
- Importing Data in R Script
- How To Import Data from a File?
- Exporting Data from scripts
- Working with CSV files
- Working with XML Files
- Working with Excel Files
- Working with JSON Files
- Reading Tabular Data from files
- Working with Databases
- Database Connectivity
- Manipulate Data Frames Using SQL
Error Handling
Data Visualization
- Graph Plotting
- Graphical Models
- Data Visualization
- Charts and Graphs
- Add Titles to a Graph
- Adding Colors to Charts
- Adding Text to Plots
- Adding axis to a Plot
- Set or View the Graphics Palette
- Plotting of Data using Generic plots
- Bar Charts
- Line Graphs
- Adding Straight Lines to a Plot
- Addition of Lines to a Plot
- Histograms
- Pie Charts
- Scatter plots
- Create Dot Charts
- Boxplots in R Language
- Stratified Boxplot
- Create a Heatmap
- Pareto Chart
- Waffle Chart
- Quantile-Quantile Plot
- Creating 3D Plots
- Describe Parts of a Chart in Graphical Form
- Principal Component Analysis
- Social Network Analysis
Statistics
- Introduction to Statistics
- Calculate the Mean, Median, and Mode
- Calculate the Average, Variance, and Standard Deviation
- Homogeneity of Variance Test
- Covariance and Correlation
- Correlation Matrix
- Visualize correlation matrix using correlogram
- Distance Matrix by GPU
- Descriptive Analysis
- Normal Distribution
- Binomial Distribution
- Compute the Negative Binomial Density
- Poisson Functions
- ANOVA Test
- MANOVA Test
- Naive Bayes Classifier
- K-NN Classifier
- Central Tendency
- Variability
- Skewness and Kurtosis
- Absolute and Relative Frequency
- Permutation Hypothesis Test
- AB Testing
- Completely Randomized Design
- Randomized Block Design
- Bartlett’s Test
- Tree Entropy
- Tukey’s Five-number Summary
- Compute Summary Statistics of Subsets
- Hypothesis Testing
- Bootstrapping
- Time Series Analysis
- T-Test Approach
Machine Learning with R
- Introduction to Machine Learning
- Setting up Environment for Machine Learning
- Supervised and Unsupervised Learning
- Classification
- Regression and its Types
- Regression Analysis
- Decision Tree
- Random Forest Approach
- Root-Mean-Square Error
- Clustering
- Hierarchical Clustering
- DBScan Clustering
- Deep Learning
- Building a Simple Neural Network
- How Neural Networks are used for Regression?
- Multi Layered Neural Networks
- Survival Analysis
- Stem and Leaf Plots

Why Use R Programming Language?
R programming language is a best resource for data science, data analysis, data visualization and machine learning. R provides various statistical techniques like statistical tests, clustering and data reduction. Graph making is easy eg. pie chart, histogram, box, plot, etc. R is totally free and open-source Programming language. The community support with the R language is very large and it works on all OS. R programming comes with many packages (libraries of functions) to solve various problems.
Applications of R Programming Language
Some of the important applications of R Programming Language are listed below:
- R is used in wide range of industries for example academics, government, insurance, retail, energy, media, technology, and electronics.
- R helps in importing and cleaning data and data analysis.
- R is used in data science. R language provides us many libraries for data science e.g. Dplyr, Ggplot2, shiny, Lubridate, Knitr, Caret, Janitor.


