R Language Tutorial Read Discuss Courses Practice Improve Article Improve Save Article Save Like Article Like R Programming Tutorial is designed for beginners and experts. This R Tutorial gives you knowledge of all concepts of R programming language. This R Language Tutorial covers all the basic and advanced concepts of R, including introduction, features, installation, variables, data types, operators, if statements, vectors, data handling, graphics, and statistical modeling. What is R Programming? R is a programming language and also a software environment for statistical computing and data analysis. R was developed by Ross Ihaka and Robert Gentleman at the university of Auckland, New Zealand. R is an open-source programming language and it is available on widely used platforms e.g. Windows, Linux, and Mac. It generally comes with a command-line interface and provides a vast list of packages for performing tasks. R is an interpreted language that supports both procedural programming and object-oriented programming. How to Install R Go to https://cloud.r-project.org/ and download the latest version of R for Windows, Mac or Linux. When you have downloaded and installed R, you can run R on your Command prompt or any IDE. Recent Articles on R! R Tutorial – Table of Content Basics Fundamentals of R Variables Input and Output Decision Making Control Flow Functions Data Structures Strings Vectors Lists Arrays Matrices Factors DataFrames Object Oriented Programming Error Handling File Handling Packages in R Data Interfaces Data Visualization Statistics Machine Learning with R Basics Introduction to R Programming Language Interesting Facts about R Programming Language R vs Python Environments in R Programming Introduction to R Studio How to Install R Studio on Windows and Linux? Creation and Execution of R File in R Studio Clear the Console and the Environment in R Studio Hello World in R Programming Fundamentals of R Basic Syntax Comments Operators Keywords Data Types Variables Introduction to Variables Scope of Variable Dynamic Scoping Lexical Scoping Lexical Scoping vs Dynamic Scoping Input and Output Taking Input from User Printing Output of R Program Print the Argument to the Screen – print() Function Decision Making Decision Making – if, if-else, if-else-if ladder, nested if-else, and switch if statement if-else statement Switch case 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 Data Structures Introduction to Data Structures 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 >>> More Functions on Strings Vectors Introduction to Vectors Operations on Vectors Append Operation on Vectors Dot Product of Vectors Types of Vectors Assigning Vectors Getting and Setting Length of the Vectors – length() Function Creating a Vector of sequenced elements – seq() Function Get the Minimum and Maximum 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 >>> More Functions on Vectors 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 Check if an Object of the Specified Name is Defined or not – exists() Function Apply a Function over a List of elements – lapply() Function Performing Operations on Multiple Lists simultaneously – mapply() Function >>> More Functions on Lists 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 >>> More Functions on Arrays 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 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 an Unordered Factor to an Ordered Factor – as.ordered() Function Checking if the Object is a Factor – is.factor() Function Convert a Vector into Factor – as.factor() Function >>> More Functions on Factors 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 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 Error Handling Introduction to Error Handling Condition Handling Debugging in R Programming 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 Data Visualization Graph Plotting Graphical Models Plotting Graphs using Two Dimensional List 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 One Dimensional Scatterplots Create a Plot Matrix of Scatterplots Create Dot Charts Boxplots in R Language Stratified Boxplot Create a Heatmap Pareto Chart Waffle Chart Draw a 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. FAQs on R Tutorial Q.1 What is Rstudio ? Answer: Rstudio is the IDE for programming in R. It is used to write scripts, access files, and make graphics. It is widely used in data science, machine learning, and research. Q.2 What are some popular packages in R? Answer: R include ggplot2 the packages for data visualization, dplyr for data manipulation, tplyr for data cleaning. Q.3 What’s the difference between R and Python? Answer: R programming Python programming Data visualization libraries and tools are good in R language. R has poor data visualization than python. Production is poor than python. Production is better than R. Model Interpretability is good in R programming language. Model Interpretability is not good in python. R has relative complex syntax and learning. Syntax is simple in python. R is used when the data analysis process requires analysis and processing. Python is used when the data analysis process require integrated with web applications. Model creation is similar to Python. Model creation is similar to R. Q.4 Which is more demanding language? Python or R? Answer: R has more demand than Python in Data science. Specific skills are needed in compare to Python which is a multi-purpose language. Last Updated : 04 Sep, 2023 Like Article Save Article Please Login to comment...