SlideShare una empresa de Scribd logo
1 de 16
By – Sarthak Bhargava |
17100BTCSE01269
Topic : R - Programming
Shri Vaishnav Vidyapeeth
Vishwavidyalaya
TABLE OF CONTENTS
• History
• Introduction
• R Basics
• Download and Install R
• GUI /IDE
• Datatypes and Operators
• Conditional Statements and Loops
• Functions
• Plotting
• Features
• Comparison with other programming languages
• Merits / Advantages
• Demerits / Disadvantages
• Conclusion
History
R is an implementation of the S programming
language combined with lexical scoping semantics, inspired
by Scheme. S was created by John Chambers in 1976, while
at Bell Labs. There are some important differences, but much
of the code written for S runs unaltered.
R was created by Ross Ihaka and Robert Gentleman at
the University of Auckland, New Zealand, and is currently
developed by the R Development Core Team (of which
Chambers is a member). R is named partly after the first names
of the first two R authors and partly as a play on the name of S.
The project was conceived in 1992, with an initial version
released in 1995 and a stable beta version (v1.0) on 29th
February, 2000.
Introduction
R is a programming language and software environment for statistical
computing and graphics. The R language is widely used among statisticians
and data miners for developing statistical software and dataanalysis.
It compiles and runs on a wide variety of UNIX platforms, Windows and Mac
OS. R can be downloaded and installed from CRAN website , CRAN stands
for Comprehensive R Archive Network.
R Basics
Download and Install R –
1. Download R from (direct download link) –
https://cran.r-project.org/bin/windows/base/R-3.6.3-win.exe
2. Run exe file
-> Select language
-> Select Location
-> Select Component
-> Select startup option
-> After installation click Finish
GUI / IDE
There are many GUI to use R language such as R studio, pycharm etc.
For this ppt, I am going to use pycharm, To use R programming in pycharm Download and install R
plugin and create R project.
( Images at Next Side)
Installation
Pycharm IDE for
R Programming
Datatypes in R and Operators
R supports various basic Datatype such as Integer,Complex, Boolean, Character etc. and R also support some
objects called R-Object which are –
1. Vectors -Vector is a sequence of data elements of the same basic type.
2. Lists – List is GenericVector.
3. Matrices – It is a collection of data elements arranged in a two-dimensional rectangular layout
4. Arrays – Arrays are the R data objects which can store data in more than two dimensions.
5. Factors – Factors are the data objects which are used to categorize the data and store it as levels.They
can store both strings and integers.
6. Data Frames - A data frame is a table or a
two-dimensional array-like structure in
which each column contains values of
one variable and each row contains one
set of values from each column.
R supports all operator (like other
Programming languages) and have some
more like “<-” which is also assignment
operator
Conditional Statements / Control Statements
–
1. If – An if statement consists of a Boolean
expression followed by one or more statements.
2. if…..else – An if statement can be followed by an
optional else statement, which executes when the
Boolean expression is false.
3. switch – A switch statement allows a variable to be
tested for equality against a list of values.
Loops –
1. repeat - Executes a sequence of statements
multiple times and abbreviates the code that
manages the loop variable.
2. while - Repeats a statement or group of
statements while a given condition is true. It tests
the condition before executing the loop body.
3. for - Like a while statement, except that it tests the
condition at the end of the loop body.
Control Statements and loops
Control statements with output
for loop with output
while loop with outputrepeat loop with output
Functions
An R function is created by using the keyword function. The basic syntax of an R function definition is as follows −
function_name <- function(arg_1,arg_2 , …..){
Function_body
return_value
}
The different parts of a function are −
1. Function Name − This is the actual name of the function. It is stored in R environment as an object with this name.
2. Arguments − An argument is a placeholder. When a function is invoked, you pass a value to the argument.
Arguments are optional; that is, a function may contain no arguments. Also arguments can have default values.
3. Function Body − The function body contains a collection of statements that defines what the function does.
4. Return Value − The return value of a function is the last expression in the function body to be evaluated.
Some of R built-in functions are –
1. c() – This is a generic function which combines its arguments.
2. seq() – Create Sequence of Number
3. mean() – Give mean of argument
4. sum() – Give Sum of arguments
5. plot() – Plot graph of argument
Plotting Example
As stated earlier, R is a programming language and software environment for
statistical analysis, graphics representation and reporting. The following are the
important features of R −
• R is a well-developed, simple and effective programming language which includes conditionals,
loops, user defined recursive functions and input and output facilities.
• R has an effective data handling and storage facility,
• R provides a suite of operators for calculations on arrays, lists, vectors and matrices.
• R provides a large, coherent and integrated collection of tools for data analysis.
• R provides graphical facilities for data analysis and display either directly at the computer or printing
at the papers.
Features of R
Comparison with other languages
R Python Java
First appeared in 1993 First appeared in 1991 First appeared in 1995
It has more functions and
packages.
It has less functions and
packages.
It has large number of inbuilt
functions and packages.
It is an interpreter base
language
It is an interpreter base
language.
It is interpreter and compiled
based language.
It is statistical design and
graphics Programming
language.
It is general purpose language
It is general purpose
Programming language
designed for web applications
It is difficult to learn and
understand.
It is easy to understand..
It is easy to learn and
understand.
R is mostly use for data
analysis.
Generic programming, tasks such
as design of softwares.
Java is mostly used in design
of windows applications and
web
Merits / Advantages
1. Open Source
2. Exemplary Support for Data Wrangling
3. The Array of Packages
4. Quality Plotting and Graphing
5. Highly Compatible
6. Platform Independent
7. Eye-Catching Reports
8. Machine Learning Operations
9. Statistics
10. Continuously Growing
Demerits / Disadvantages
1. Weak Origin
2. Data Handling
3. Basic Security
4. Complicated Language
5. Lesser Speed
6. Spread Across various Packages
Conclusion
• R is a OOPs Programming language which is mostly used by data
analytics and data scientists.
• R is Interpreted language having some syntax of java as well as
Python.
• R supports all datatype and supports different data-structures called
R-objects
• R is mostly used for Plotting Purposes.
• R mostly use Functions and packages.
At last R provides us an Eye-Catching Reports and can easily plot graph
of given data which is easy to read and understand, this is also a reason
why it is soo popular,
Thank You

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

R programming
R programmingR programming
R programming
 
R Programming
R ProgrammingR Programming
R Programming
 
Data Management in R
Data Management in RData Management in R
Data Management in R
 
Linear regression
Linear regressionLinear regression
Linear regression
 
Regression analysis in R
Regression analysis in RRegression analysis in R
Regression analysis in R
 
3. R- list and data frame
3. R- list and data frame3. R- list and data frame
3. R- list and data frame
 
Step By Step Guide to Learn R
Step By Step Guide to Learn RStep By Step Guide to Learn R
Step By Step Guide to Learn R
 
Star schema
Star schemaStar schema
Star schema
 
R basics
R basicsR basics
R basics
 
Introduction to R programming
Introduction to R programmingIntroduction to R programming
Introduction to R programming
 
Data visualization with R
Data visualization with RData visualization with R
Data visualization with R
 
Regular expressions-Theory of computation
Regular expressions-Theory of computationRegular expressions-Theory of computation
Regular expressions-Theory of computation
 
Introduction to R programming
Introduction to R programmingIntroduction to R programming
Introduction to R programming
 
SAS BASICS
SAS BASICSSAS BASICS
SAS BASICS
 
Getting Started with R
Getting Started with RGetting Started with R
Getting Started with R
 
Logistic Regression in Python | Logistic Regression Example | Machine Learnin...
Logistic Regression in Python | Logistic Regression Example | Machine Learnin...Logistic Regression in Python | Logistic Regression Example | Machine Learnin...
Logistic Regression in Python | Logistic Regression Example | Machine Learnin...
 
Data Wrangling with dplyr and tidyr Cheat Sheet
Data Wrangling with dplyr and tidyr Cheat SheetData Wrangling with dplyr and tidyr Cheat Sheet
Data Wrangling with dplyr and tidyr Cheat Sheet
 
6. R data structures
6. R data structures6. R data structures
6. R data structures
 
How to get started with R programming
How to get started with R programmingHow to get started with R programming
How to get started with R programming
 
Data analytics with R
Data analytics with RData analytics with R
Data analytics with R
 

Similar a R programming Language

FULL R PROGRAMMING METERIAL_2.pdf
FULL R PROGRAMMING METERIAL_2.pdfFULL R PROGRAMMING METERIAL_2.pdf
FULL R PROGRAMMING METERIAL_2.pdf
attalurilalitha
 
Language design and translation issues
Language design and translation issuesLanguage design and translation issues
Language design and translation issues
SURBHI SAROHA
 
r,rstats,r language,r packages
r,rstats,r language,r packagesr,rstats,r language,r packages
r,rstats,r language,r packages
Ajay Ohri
 
Unit1 principle of programming language
Unit1 principle of programming languageUnit1 principle of programming language
Unit1 principle of programming language
Vasavi College of Engg
 

Similar a R programming Language (20)

1_Introduction.pptx
1_Introduction.pptx1_Introduction.pptx
1_Introduction.pptx
 
R Programming Language
R Programming LanguageR Programming Language
R Programming Language
 
R basics for MBA Students[1].pptx
R basics for MBA Students[1].pptxR basics for MBA Students[1].pptx
R basics for MBA Students[1].pptx
 
R programming Language , Rahul Singh
R programming Language , Rahul SinghR programming Language , Rahul Singh
R programming Language , Rahul Singh
 
Financial Risk Mgt - Lec 4 by Dr. Syed Muhammad Ali Tirmizi
Financial Risk Mgt - Lec 4 by Dr. Syed Muhammad Ali TirmiziFinancial Risk Mgt - Lec 4 by Dr. Syed Muhammad Ali Tirmizi
Financial Risk Mgt - Lec 4 by Dr. Syed Muhammad Ali Tirmizi
 
Data Science - Part II - Working with R & R studio
Data Science - Part II -  Working with R & R studioData Science - Part II -  Working with R & R studio
Data Science - Part II - Working with R & R studio
 
FULL R PROGRAMMING METERIAL_2.pdf
FULL R PROGRAMMING METERIAL_2.pdfFULL R PROGRAMMING METERIAL_2.pdf
FULL R PROGRAMMING METERIAL_2.pdf
 
Language-agnostic data analysis workflows and reproducible research
Language-agnostic data analysis workflows and reproducible researchLanguage-agnostic data analysis workflows and reproducible research
Language-agnostic data analysis workflows and reproducible research
 
Presentation c++
Presentation c++Presentation c++
Presentation c++
 
R Course Online
R Course OnlineR Course Online
R Course Online
 
Language design and translation issues
Language design and translation issuesLanguage design and translation issues
Language design and translation issues
 
Introduction to R and R Studio
Introduction to R and R StudioIntroduction to R and R Studio
Introduction to R and R Studio
 
R training
R trainingR training
R training
 
Inroduction to r
Inroduction to rInroduction to r
Inroduction to r
 
r,rstats,r language,r packages
r,rstats,r language,r packagesr,rstats,r language,r packages
r,rstats,r language,r packages
 
Lecture1
Lecture1Lecture1
Lecture1
 
Unit1 principle of programming language
Unit1 principle of programming languageUnit1 principle of programming language
Unit1 principle of programming language
 
C Programming UNIT 1.pptx
C Programming  UNIT 1.pptxC Programming  UNIT 1.pptx
C Programming UNIT 1.pptx
 
Study of R Programming
Study of R ProgrammingStudy of R Programming
Study of R Programming
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 

Último

Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 

Último (20)

Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 

R programming Language

  • 1. By – Sarthak Bhargava | 17100BTCSE01269 Topic : R - Programming Shri Vaishnav Vidyapeeth Vishwavidyalaya
  • 2. TABLE OF CONTENTS • History • Introduction • R Basics • Download and Install R • GUI /IDE • Datatypes and Operators • Conditional Statements and Loops • Functions • Plotting • Features • Comparison with other programming languages • Merits / Advantages • Demerits / Disadvantages • Conclusion
  • 3. History R is an implementation of the S programming language combined with lexical scoping semantics, inspired by Scheme. S was created by John Chambers in 1976, while at Bell Labs. There are some important differences, but much of the code written for S runs unaltered. R was created by Ross Ihaka and Robert Gentleman at the University of Auckland, New Zealand, and is currently developed by the R Development Core Team (of which Chambers is a member). R is named partly after the first names of the first two R authors and partly as a play on the name of S. The project was conceived in 1992, with an initial version released in 1995 and a stable beta version (v1.0) on 29th February, 2000.
  • 4. Introduction R is a programming language and software environment for statistical computing and graphics. The R language is widely used among statisticians and data miners for developing statistical software and dataanalysis. It compiles and runs on a wide variety of UNIX platforms, Windows and Mac OS. R can be downloaded and installed from CRAN website , CRAN stands for Comprehensive R Archive Network.
  • 5. R Basics Download and Install R – 1. Download R from (direct download link) – https://cran.r-project.org/bin/windows/base/R-3.6.3-win.exe 2. Run exe file -> Select language -> Select Location -> Select Component -> Select startup option -> After installation click Finish GUI / IDE There are many GUI to use R language such as R studio, pycharm etc. For this ppt, I am going to use pycharm, To use R programming in pycharm Download and install R plugin and create R project. ( Images at Next Side)
  • 7. Datatypes in R and Operators R supports various basic Datatype such as Integer,Complex, Boolean, Character etc. and R also support some objects called R-Object which are – 1. Vectors -Vector is a sequence of data elements of the same basic type. 2. Lists – List is GenericVector. 3. Matrices – It is a collection of data elements arranged in a two-dimensional rectangular layout 4. Arrays – Arrays are the R data objects which can store data in more than two dimensions. 5. Factors – Factors are the data objects which are used to categorize the data and store it as levels.They can store both strings and integers. 6. Data Frames - A data frame is a table or a two-dimensional array-like structure in which each column contains values of one variable and each row contains one set of values from each column. R supports all operator (like other Programming languages) and have some more like “<-” which is also assignment operator
  • 8. Conditional Statements / Control Statements – 1. If – An if statement consists of a Boolean expression followed by one or more statements. 2. if…..else – An if statement can be followed by an optional else statement, which executes when the Boolean expression is false. 3. switch – A switch statement allows a variable to be tested for equality against a list of values. Loops – 1. repeat - Executes a sequence of statements multiple times and abbreviates the code that manages the loop variable. 2. while - Repeats a statement or group of statements while a given condition is true. It tests the condition before executing the loop body. 3. for - Like a while statement, except that it tests the condition at the end of the loop body. Control Statements and loops Control statements with output for loop with output while loop with outputrepeat loop with output
  • 9. Functions An R function is created by using the keyword function. The basic syntax of an R function definition is as follows − function_name <- function(arg_1,arg_2 , …..){ Function_body return_value } The different parts of a function are − 1. Function Name − This is the actual name of the function. It is stored in R environment as an object with this name. 2. Arguments − An argument is a placeholder. When a function is invoked, you pass a value to the argument. Arguments are optional; that is, a function may contain no arguments. Also arguments can have default values. 3. Function Body − The function body contains a collection of statements that defines what the function does. 4. Return Value − The return value of a function is the last expression in the function body to be evaluated. Some of R built-in functions are – 1. c() – This is a generic function which combines its arguments. 2. seq() – Create Sequence of Number 3. mean() – Give mean of argument 4. sum() – Give Sum of arguments 5. plot() – Plot graph of argument
  • 11. As stated earlier, R is a programming language and software environment for statistical analysis, graphics representation and reporting. The following are the important features of R − • R is a well-developed, simple and effective programming language which includes conditionals, loops, user defined recursive functions and input and output facilities. • R has an effective data handling and storage facility, • R provides a suite of operators for calculations on arrays, lists, vectors and matrices. • R provides a large, coherent and integrated collection of tools for data analysis. • R provides graphical facilities for data analysis and display either directly at the computer or printing at the papers. Features of R
  • 12. Comparison with other languages R Python Java First appeared in 1993 First appeared in 1991 First appeared in 1995 It has more functions and packages. It has less functions and packages. It has large number of inbuilt functions and packages. It is an interpreter base language It is an interpreter base language. It is interpreter and compiled based language. It is statistical design and graphics Programming language. It is general purpose language It is general purpose Programming language designed for web applications It is difficult to learn and understand. It is easy to understand.. It is easy to learn and understand. R is mostly use for data analysis. Generic programming, tasks such as design of softwares. Java is mostly used in design of windows applications and web
  • 13. Merits / Advantages 1. Open Source 2. Exemplary Support for Data Wrangling 3. The Array of Packages 4. Quality Plotting and Graphing 5. Highly Compatible 6. Platform Independent 7. Eye-Catching Reports 8. Machine Learning Operations 9. Statistics 10. Continuously Growing
  • 14. Demerits / Disadvantages 1. Weak Origin 2. Data Handling 3. Basic Security 4. Complicated Language 5. Lesser Speed 6. Spread Across various Packages
  • 15. Conclusion • R is a OOPs Programming language which is mostly used by data analytics and data scientists. • R is Interpreted language having some syntax of java as well as Python. • R supports all datatype and supports different data-structures called R-objects • R is mostly used for Plotting Purposes. • R mostly use Functions and packages. At last R provides us an Eye-Catching Reports and can easily plot graph of given data which is easy to read and understand, this is also a reason why it is soo popular,