SlideShare a Scribd company logo
1 of 76
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Introduction to R for Quantitative Research 
Parthasarathi Edupally 
CRISIL, GR & A 
NBT@CRISIL, Nov 2014
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Outline 
1. Motivation and Objective 
What is this module about ? 
Why learn R ?
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Outline 
1. Motivation and Objective 
What is this module about ? 
Why learn R ? 
2. Fundamentals 
Language Foundations 
Functions 
Data
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Outline 
1. Motivation and Objective 
What is this module about ? 
Why learn R ? 
2. Fundamentals 
Language Foundations 
Functions 
Data 
3. Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional Programming
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Outline 
1. Motivation and Objective 
What is this module about ? 
Why learn R ? 
2. Fundamentals 
Language Foundations 
Functions 
Data 
3. Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional Programming 
4. Further Reading and References 
Advanced Topics 
References
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Outline 
1. Motivation and Objective 
What is this module about ? 
Why learn R ? 
2. Fundamentals 
Language Foundations 
Functions 
Data 
3. Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional Programming 
4. Further Reading and References 
Advanced Topics 
References 
5. Thank You
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
What is this module about ?
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
What is this module about ? 
 An introduction to R statistical software - Just an Intro! 
 Understanding of language fundamentals than lot of 
language specific details
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
What is this module about ? 
 An introduction to R statistical software - Just an Intro! 
 Understanding of language fundamentals than lot of 
language specific details 
 Targeted people - Analysts with no formal software 
background
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
What is this module about ? 
 An introduction to R statistical software - Just an Intro! 
 Understanding of language fundamentals than lot of 
language specific details 
 Targeted people - Analysts with no formal software 
background 
 Just to give a head start in learning and using R for analysis.
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Why learn R ?
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Why learn R ? 
 This is why you should : 
 Its open source, anyone can replicate your results 
 A massive set of packages for statistical analysis, machine 
learning etc 
 Specially designed for statistics and Data analysis with 
features like missing values, Dataframes, subsetting etc
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Why learn R ? 
 This is why you should : 
 Its open source, anyone can replicate your results 
 A massive set of packages for statistical analysis, machine 
learning etc 
 Specially designed for statistics and Data analysis with 
features like missing values, Dataframes, subsetting etc 
 Strong foundations in functional programming 
 Designed to connect to low level languages for high 
performance
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Why learn R ? 
 This is why you should : 
 Its open source, anyone can replicate your results 
 A massive set of packages for statistical analysis, machine 
learning etc 
 Specially designed for statistics and Data analysis with 
features like missing values, Dataframes, subsetting etc 
 Strong foundations in functional programming 
 Designed to connect to low level languages for high 
performance 
 Some drawbacks :
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Why learn R ? 
 This is why you should : 
 Its open source, anyone can replicate your results 
 A massive set of packages for statistical analysis, machine 
learning etc 
 Specially designed for statistics and Data analysis with 
features like missing values, Dataframes, subsetting etc 
 Strong foundations in functional programming 
 Designed to connect to low level languages for high 
performance 
 Some drawbacks : 
 Most of the code is written in haste to solve a pressing 
problem at hand, so code is less elegant, less faster and less 
easier to understand. 
 It is not particularly fast programming language.
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Expressions
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Expressions 
 Most often when we write code we are writing an expression 
 Expression describes a computation and evaluates to a value
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Expressions 
 Most often when we write code we are writing an expression 
 Expression describes a computation and evaluates to a value 
 In Math - addition, division etc 
 All expressions can be represented by a function notation - It 
is the most general representation
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Expressions 
 Most often when we write code we are writing an expression 
 Expression describes a computation and evaluates to a value 
 In Math - addition, division etc 
 All expressions can be represented by a function notation - It 
is the most general representation 
 Types of expressions : 
 primitive expression – Numbers, Names, Strings 
 call expressions – operator(op1; op2)
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Expressions 
 Most often when we write code we are writing an expression 
 Expression describes a computation and evaluates to a value 
 In Math - addition, division etc 
 All expressions can be represented by a function notation - It 
is the most general representation 
 Types of expressions : 
 primitive expression – Numbers, Names, Strings 
 call expressions – operator(op1; op2) 
Demo
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Statements
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Statements 
 They are used to perform an action, they don’t evaluate to 
value
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Statements 
 They are used to perform an action, they don’t evaluate to 
value 
 There can be conditional and iterative statements
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Statements 
 They are used to perform an action, they don’t evaluate to 
value 
 There can be conditional and iterative statements 
 Conditional statements: 
 if-elseif-else
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Statements 
 They are used to perform an action, they don’t evaluate to 
value 
 There can be conditional and iterative statements 
 Conditional statements: 
 if-elseif-else 
 Iterative statements: 
 for() fg 
 while() fg
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Statements 
 They are used to perform an action, they don’t evaluate to 
value 
 There can be conditional and iterative statements 
 Conditional statements: 
 if-elseif-else 
 Iterative statements: 
 for() fg 
 while() fg 
Demo
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Environments
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Environments 
 They are used by the interpreter to understand the scoping 
rules i.e., where to look for variables and functions by names
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Environments 
 They are used by the interpreter to understand the scoping 
rules i.e., where to look for variables and functions by names 
 Job of an environment is to bind set of names to set of values 
(a bag of names) 
 Each name points to an object stored elsewhere in memory
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Environments 
 They are used by the interpreter to understand the scoping 
rules i.e., where to look for variables and functions by names 
 Job of an environment is to bind set of names to set of values 
(a bag of names) 
 Each name points to an object stored elsewhere in memory 
 Developers mainly use them while writing packages to avoid 
naming conflicts. 
.
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Environments 
 They are used by the interpreter to understand the scoping 
rules i.e., where to look for variables and functions by names 
 Job of an environment is to bind set of names to set of values 
(a bag of names) 
 Each name points to an object stored elsewhere in memory 
 Developers mainly use them while writing packages to avoid 
naming conflicts. 
.
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
User-defined functions
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
User-defined functions 
 R is designed to support functional programming style. So 
most of the computation we do will be a function call.
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
User-defined functions 
 R is designed to support functional programming style. So 
most of the computation we do will be a function call. 
 Life cycle of user-defined function : 
 Function definition - name bound to that function in current 
environment (enclosing environment) 
 Function call- A new environment(calling environment) is 
created and call expression is executed
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
User-defined functions 
 R is designed to support functional programming style. So 
most of the computation we do will be a function call. 
 Life cycle of user-defined function : 
 Function definition - name bound to that function in current 
environment (enclosing environment) 
 Function call- A new environment(calling environment) is 
created and call expression is executed 
 Please note there is execution environment, environment in 
which function was called.
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
User-defined functions 
 R is designed to support functional programming style. So 
most of the computation we do will be a function call. 
 Life cycle of user-defined function : 
 Function definition - name bound to that function in current 
environment (enclosing environment) 
 Function call- A new environment(calling environment) is 
created and call expression is executed 
 Please note there is execution environment, environment in 
which function was called. 
Demo
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Data Type
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Data Type 
 Every data will have a type associated with it. Basic types in 
R are - Integer, Double, Character and factor.
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Data Type 
 Every data will have a type associated with it. Basic types in 
R are - Integer, Double, Character and factor. 
 Native data types : 
 Have primitive expressions that evaluate to values of these 
types 
 Built-in functions, operators, methods to manipulate those 
values
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Data Type 
 Every data will have a type associated with it. Basic types in 
R are - Integer, Double, Character and factor. 
 Native data types : 
 Have primitive expressions that evaluate to values of these 
types 
 Built-in functions, operators, methods to manipulate those 
values 
 We restrict data to be some number, vector or matrix with 
values in them. But Data is much more general and powerful 
than this. 
 Important idea in computer science is Code is also data. So 
a piece of code which does square root computation is data 
and can have type associated with it.
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Data Type 
 Every data will have a type associated with it. Basic types in 
R are - Integer, Double, Character and factor. 
 Native data types : 
 Have primitive expressions that evaluate to values of these 
types 
 Built-in functions, operators, methods to manipulate those 
values 
 We restrict data to be some number, vector or matrix with 
values in them. But Data is much more general and powerful 
than this. 
 Important idea in computer science is Code is also data. So 
a piece of code which does square root computation is data 
and can have type associated with it. 
 These lead us to Abstract data types (Data structures), which 
are based on the concept of objects.
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Objects
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Objects 
 Objects represent information - consist of data and 
behaviour. So they are more powerful than just data.
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Objects 
 Objects represent information - consist of data and 
behaviour. So they are more powerful than just data. 
 They can represent - things, properties, Interactions, 
processes
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Objects 
 Objects represent information - consist of data and 
behaviour. So they are more powerful than just data. 
 They can represent - things, properties, Interactions, 
processes 
 Type of an object is called class 
 A class is some collection of methods(functions) and 
behaviour conditions defined in it.
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Data structures
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Data structures 
 These are abstract data types defined in R and can be 
organised according to their dimensionality and whether they 
are homogeneous.
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Data structures 
 These are abstract data types defined in R and can be 
organised according to their dimensionality and whether they 
are homogeneous. 
 One dimensional structures - Atomic vectors, lists 
 Two dimensional structures - Matrices, Data frames 
 Multidimensional - Arrays
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Data structures 
 These are abstract data types defined in R and can be 
organised according to their dimensionality and whether they 
are homogeneous. 
 One dimensional structures - Atomic vectors, lists 
 Two dimensional structures - Matrices, Data frames 
 Multidimensional - Arrays 
 A data frame is the most common way of storing data in R, 
and makes data analysis easier
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Data structures 
 These are abstract data types defined in R and can be 
organised according to their dimensionality and whether they 
are homogeneous. 
 One dimensional structures - Atomic vectors, lists 
 Two dimensional structures - Matrices, Data frames 
 Multidimensional - Arrays 
 A data frame is the most common way of storing data in R, 
and makes data analysis easier Demo
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Simple Rules for efficiency
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Simple Rules for efficiency 
 Folder Structure : Always maintain a consistent folder 
structure for all projects.
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Simple Rules for efficiency 
 Folder Structure : Always maintain a consistent folder 
structure for all projects. 
 Naming: Give sensible names to files and variables 
 Always use comments to describe every line or group of 
lines of code. 
 indentation : Follow consistent and creative indentations 
while writing code.
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Simple Rules for efficiency 
 Folder Structure : Always maintain a consistent folder 
structure for all projects. 
 Naming: Give sensible names to files and variables 
 Always use comments to describe every line or group of 
lines of code. 
 indentation : Follow consistent and creative indentations 
while writing code. 
 README : Draft README file in every folder. These have 
to give brief description of files in the current folder.
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Subsetting
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Subsetting 
 Subsetting allows us to succinctly express complex 
operations on large datasets. 
 They are very useful in data cleaning, which is first step in 
data analysis. 
 It basically involves selecting and modifying specific 
portions of data.
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Subsetting 
 Subsetting allows us to succinctly express complex 
operations on large datasets. 
 They are very useful in data cleaning, which is first step in 
data analysis. 
 It basically involves selecting and modifying specific 
portions of data. 
 Subsetting Atomic vectors, lists, matrices, arrays and data 
frames
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Subsetting 
 Subsetting allows us to succinctly express complex 
operations on large datasets. 
 They are very useful in data cleaning, which is first step in 
data analysis. 
 It basically involves selecting and modifying specific 
portions of data. 
 Subsetting Atomic vectors, lists, matrices, arrays and data 
frames Demo
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Functional Programming Paradigm
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Functional Programming Paradigm 
 R at heart is a functional programming language - gives tools 
for creation and manipulation of functions.
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Functional Programming Paradigm 
 R at heart is a functional programming language - gives tools 
for creation and manipulation of functions. 
 FP allows to write code clearly, concisely and at high level of 
abstraction.
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Functional Programming Paradigm 
 R at heart is a functional programming language - gives tools 
for creation and manipulation of functions. 
 FP allows to write code clearly, concisely and at high level of 
abstraction. 
 It supports reusable software components. 
 Encourages the use of formal verification.
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Functional Programming Paradigm 
 R at heart is a functional programming language - gives tools 
for creation and manipulation of functions. 
 FP allows to write code clearly, concisely and at high level of 
abstraction. 
 It supports reusable software components. 
 Encourages the use of formal verification. 
 With latest trend of Multicore processors, FP is very 
amenable to parallel programming.
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Important Advanced Topics
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Important Advanced Topics 
 Object systems in R
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Important Advanced Topics 
 Object systems in R 
 Basic Version Control with GitHub
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Important Advanced Topics 
 Object systems in R 
 Basic Version Control with GitHub 
 More Advanced Subsetting
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Important Advanced Topics 
 Object systems in R 
 Basic Version Control with GitHub 
 More Advanced Subsetting 
 Functional programming paradigm
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Important Advanced Topics 
 Object systems in R 
 Basic Version Control with GitHub 
 More Advanced Subsetting 
 Functional programming paradigm 
 Memory usage in R
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Important Advanced Topics 
 Object systems in R 
 Basic Version Control with GitHub 
 More Advanced Subsetting 
 Functional programming paradigm 
 Memory usage in R 
 Using lower level languages for better performance where 
ever required in R
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Resources
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Resources 
 Advanced R by Hadley Wickham
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Resources 
 Advanced R by Hadley Wickham 
 Structure and Interpretation of Computer Programs - Berkley 
webcast(CS61A, Fall 2013)
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
Resources 
 Advanced R by Hadley Wickham 
 Structure and Interpretation of Computer Programs - Berkley 
webcast(CS61A, Fall 2013) 
 R package documentation
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You
Introduction to 
R for 
Quantitative 
Research 
Parthasarathi 
Edupally 
Motivation and 
Objective 
What is this module 
about ? 
Why learn R ? 
Fundamentals 
Language Foundations 
Functions 
Data 
Essentials 
Basic Coding Etiquttes 
Subsetting 
Basic Functional 
Programming 
Further Reading 
and References 
Advanced Topics 
References 
Thank You 
“To understand computations in R, two slogans are 
helpful: 
Everything that exists is an object. 
Everything that happens is a function call.” 
John Chambers (Inventor of R).

More Related Content

What's hot

Answer Selection and Validation for Arabic Questions
Answer Selection and Validation for Arabic QuestionsAnswer Selection and Validation for Arabic Questions
Answer Selection and Validation for Arabic Questions
Ahmed Magdy Ezzeldin, MSc.
 

What's hot (8)

2010 PACLIC - pay attention to categories
2010 PACLIC - pay attention to categories2010 PACLIC - pay attention to categories
2010 PACLIC - pay attention to categories
 
Instant Question Answering System
Instant Question Answering SystemInstant Question Answering System
Instant Question Answering System
 
Arabic question answering ‫‬
Arabic question answering ‫‬Arabic question answering ‫‬
Arabic question answering ‫‬
 
Natural language processing: feature extraction
Natural language processing: feature extractionNatural language processing: feature extraction
Natural language processing: feature extraction
 
Chinese Character Decomposition for Neural MT with Multi-Word Expressions
Chinese Character Decomposition for  Neural MT with Multi-Word ExpressionsChinese Character Decomposition for  Neural MT with Multi-Word Expressions
Chinese Character Decomposition for Neural MT with Multi-Word Expressions
 
Natural Language Processing, Techniques, Current Trends and Applications in I...
Natural Language Processing, Techniques, Current Trends and Applications in I...Natural Language Processing, Techniques, Current Trends and Applications in I...
Natural Language Processing, Techniques, Current Trends and Applications in I...
 
Answer Selection and Validation for Arabic Questions
Answer Selection and Validation for Arabic QuestionsAnswer Selection and Validation for Arabic Questions
Answer Selection and Validation for Arabic Questions
 
Meta-evaluation of machine translation evaluation methods
Meta-evaluation of machine translation evaluation methodsMeta-evaluation of machine translation evaluation methods
Meta-evaluation of machine translation evaluation methods
 

Viewers also liked

Introduction to Quantitative Research Methods
Introduction to Quantitative Research MethodsIntroduction to Quantitative Research Methods
Introduction to Quantitative Research Methods
Iman Ardekani
 
Descriptive statistics
Descriptive statisticsDescriptive statistics
Descriptive statistics
Aileen Balbido
 
Descriptive statistics
Descriptive statisticsDescriptive statistics
Descriptive statistics
kemdoby
 
Descriptive statistics
Descriptive statisticsDescriptive statistics
Descriptive statistics
Aiden Yeh
 
Data analysis powerpoint
Data analysis powerpointData analysis powerpoint
Data analysis powerpoint
Sarah Hallum
 
Data analysis powerpoint
Data analysis powerpointData analysis powerpoint
Data analysis powerpoint
jamiebrandon
 
Ppt. types of quantitative research
Ppt.  types of quantitative researchPpt.  types of quantitative research
Ppt. types of quantitative research
Nursing Path
 

Viewers also liked (13)

Quantifying News For Automated Trading - Methodology and Profitability
Quantifying News For Automated Trading - Methodology and ProfitabilityQuantifying News For Automated Trading - Methodology and Profitability
Quantifying News For Automated Trading - Methodology and Profitability
 
Introduction to Quantitative Research Methods
Introduction to Quantitative Research MethodsIntroduction to Quantitative Research Methods
Introduction to Quantitative Research Methods
 
Descriptive statistics
Descriptive statisticsDescriptive statistics
Descriptive statistics
 
Descriptive statistics
Descriptive statisticsDescriptive statistics
Descriptive statistics
 
Descriptive statistics
Descriptive statisticsDescriptive statistics
Descriptive statistics
 
Basic Descriptive Statistics
Basic Descriptive StatisticsBasic Descriptive Statistics
Basic Descriptive Statistics
 
Descriptive statistics
Descriptive statisticsDescriptive statistics
Descriptive statistics
 
Descriptive statistics
Descriptive statisticsDescriptive statistics
Descriptive statistics
 
Descriptive Statistics
Descriptive StatisticsDescriptive Statistics
Descriptive Statistics
 
Data analysis powerpoint
Data analysis powerpointData analysis powerpoint
Data analysis powerpoint
 
Data analysis powerpoint
Data analysis powerpointData analysis powerpoint
Data analysis powerpoint
 
Ppt. types of quantitative research
Ppt.  types of quantitative researchPpt.  types of quantitative research
Ppt. types of quantitative research
 
Data Analysis: Descriptive Statistics
Data Analysis: Descriptive StatisticsData Analysis: Descriptive Statistics
Data Analysis: Descriptive Statistics
 

Similar to Introduction to R for Quantitative Research

Session1 pl online_course_19_may2011
Session1  pl online_course_19_may2011Session1  pl online_course_19_may2011
Session1 pl online_course_19_may2011
LeslieOflahavan
 
Session1_WMU_Plain_Language_Online_19May2011
Session1_WMU_Plain_Language_Online_19May2011Session1_WMU_Plain_Language_Online_19May2011
Session1_WMU_Plain_Language_Online_19May2011
LeslieOflahavan
 
Session1 pl online_course_8_september2011
Session1  pl online_course_8_september2011Session1  pl online_course_8_september2011
Session1 pl online_course_8_september2011
LeslieOflahavan
 
New Content for Week 5 System Implementation and Maintenance
New Content for Week 5 System Implementation and MaintenanceNew Content for Week 5 System Implementation and Maintenance
New Content for Week 5 System Implementation and Maintenance
elliotkimberlee
 
Business Analytics with R
Business Analytics with RBusiness Analytics with R
Business Analytics with R
Edureka!
 
Business Analytics with R
Business Analytics with RBusiness Analytics with R
Business Analytics with R
Edureka!
 

Similar to Introduction to R for Quantitative Research (20)

Reason To learn & use r
Reason To learn & use rReason To learn & use r
Reason To learn & use r
 
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
 
Session1 pl online_course_19_may2011
Session1  pl online_course_19_may2011Session1  pl online_course_19_may2011
Session1 pl online_course_19_may2011
 
Publish perish as an instruction-end learning opportunity
Publish perish as an instruction-end learning opportunityPublish perish as an instruction-end learning opportunity
Publish perish as an instruction-end learning opportunity
 
Session1_WMU_Plain_Language_Online_19May2011
Session1_WMU_Plain_Language_Online_19May2011Session1_WMU_Plain_Language_Online_19May2011
Session1_WMU_Plain_Language_Online_19May2011
 
Session1 pl online_course_8_september2011
Session1  pl online_course_8_september2011Session1  pl online_course_8_september2011
Session1 pl online_course_8_september2011
 
Lec 0 p pl
Lec 0 p plLec 0 p pl
Lec 0 p pl
 
The Statistical Significance of "R"
The Statistical Significance of "R"The Statistical Significance of "R"
The Statistical Significance of "R"
 
New Content for Week 5 System Implementation and Maintenance
New Content for Week 5 System Implementation and MaintenanceNew Content for Week 5 System Implementation and Maintenance
New Content for Week 5 System Implementation and Maintenance
 
Python For SEO specialists and Content Marketing - Hand in Hand
Python For SEO specialists and Content Marketing - Hand in HandPython For SEO specialists and Content Marketing - Hand in Hand
Python For SEO specialists and Content Marketing - Hand in Hand
 
Data+Science+Foundation+Program+Learnbay.pdf
Data+Science+Foundation+Program+Learnbay.pdfData+Science+Foundation+Program+Learnbay.pdf
Data+Science+Foundation+Program+Learnbay.pdf
 
0. Course Introduction
0. Course Introduction0. Course Introduction
0. Course Introduction
 
Technical Documentation By Techies
Technical Documentation By TechiesTechnical Documentation By Techies
Technical Documentation By Techies
 
Business Analytics with R
Business Analytics with RBusiness Analytics with R
Business Analytics with R
 
Description about python
Description about pythonDescription about python
Description about python
 
The Editor as EAP Instructor
The Editor as EAP InstructorThe Editor as EAP Instructor
The Editor as EAP Instructor
 
Requirements Engineering: focus on Natural Language Processing, Lecture 2
Requirements Engineering: focus on Natural Language Processing, Lecture 2Requirements Engineering: focus on Natural Language Processing, Lecture 2
Requirements Engineering: focus on Natural Language Processing, Lecture 2
 
Business Analytics with R
Business Analytics with RBusiness Analytics with R
Business Analytics with R
 
An introduction to python | Python Assignment Help
An introduction to python | Python Assignment HelpAn introduction to python | Python Assignment Help
An introduction to python | Python Assignment Help
 
R programming
R programmingR programming
R programming
 

Recently uploaded

Bacterial Identification and Classifications
Bacterial Identification and ClassificationsBacterial Identification and Classifications
Bacterial Identification and Classifications
Areesha Ahmad
 
Module for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learningModule for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learning
levieagacer
 
SCIENCE-4-QUARTER4-WEEK-4-PPT-1 (1).pptx
SCIENCE-4-QUARTER4-WEEK-4-PPT-1 (1).pptxSCIENCE-4-QUARTER4-WEEK-4-PPT-1 (1).pptx
SCIENCE-4-QUARTER4-WEEK-4-PPT-1 (1).pptx
RizalinePalanog2
 

Recently uploaded (20)

Kochi ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Kochi ESCORT SERVICE❤CALL GIRL
Kochi ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Kochi ESCORT SERVICE❤CALL GIRLKochi ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Kochi ESCORT SERVICE❤CALL GIRL
Kochi ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Kochi ESCORT SERVICE❤CALL GIRL
 
Zoology 5th semester notes( Sumit_yadav).pdf
Zoology 5th semester notes( Sumit_yadav).pdfZoology 5th semester notes( Sumit_yadav).pdf
Zoology 5th semester notes( Sumit_yadav).pdf
 
Bacterial Identification and Classifications
Bacterial Identification and ClassificationsBacterial Identification and Classifications
Bacterial Identification and Classifications
 
Module for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learningModule for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learning
 
CELL -Structural and Functional unit of life.pdf
CELL -Structural and Functional unit of life.pdfCELL -Structural and Functional unit of life.pdf
CELL -Structural and Functional unit of life.pdf
 
Clean In Place(CIP).pptx .
Clean In Place(CIP).pptx                 .Clean In Place(CIP).pptx                 .
Clean In Place(CIP).pptx .
 
STS-UNIT 4 CLIMATE CHANGE POWERPOINT PRESENTATION
STS-UNIT 4 CLIMATE CHANGE POWERPOINT PRESENTATIONSTS-UNIT 4 CLIMATE CHANGE POWERPOINT PRESENTATION
STS-UNIT 4 CLIMATE CHANGE POWERPOINT PRESENTATION
 
Factory Acceptance Test( FAT).pptx .
Factory Acceptance Test( FAT).pptx       .Factory Acceptance Test( FAT).pptx       .
Factory Acceptance Test( FAT).pptx .
 
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
 
Pulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceuticsPulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceutics
 
FAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
FAIRSpectra - Enabling the FAIRification of Spectroscopy and SpectrometryFAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
FAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
 
SCIENCE-4-QUARTER4-WEEK-4-PPT-1 (1).pptx
SCIENCE-4-QUARTER4-WEEK-4-PPT-1 (1).pptxSCIENCE-4-QUARTER4-WEEK-4-PPT-1 (1).pptx
SCIENCE-4-QUARTER4-WEEK-4-PPT-1 (1).pptx
 
Feature-aligned N-BEATS with Sinkhorn divergence (ICLR '24)
Feature-aligned N-BEATS with Sinkhorn divergence (ICLR '24)Feature-aligned N-BEATS with Sinkhorn divergence (ICLR '24)
Feature-aligned N-BEATS with Sinkhorn divergence (ICLR '24)
 
Locating and isolating a gene, FISH, GISH, Chromosome walking and jumping, te...
Locating and isolating a gene, FISH, GISH, Chromosome walking and jumping, te...Locating and isolating a gene, FISH, GISH, Chromosome walking and jumping, te...
Locating and isolating a gene, FISH, GISH, Chromosome walking and jumping, te...
 
SAMASTIPUR CALL GIRL 7857803690 LOW PRICE ESCORT SERVICE
SAMASTIPUR CALL GIRL 7857803690  LOW PRICE  ESCORT SERVICESAMASTIPUR CALL GIRL 7857803690  LOW PRICE  ESCORT SERVICE
SAMASTIPUR CALL GIRL 7857803690 LOW PRICE ESCORT SERVICE
 
GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)
 
module for grade 9 for distance learning
module for grade 9 for distance learningmodule for grade 9 for distance learning
module for grade 9 for distance learning
 
Unit5-Cloud.pptx for lpu course cse121 o
Unit5-Cloud.pptx for lpu course cse121 oUnit5-Cloud.pptx for lpu course cse121 o
Unit5-Cloud.pptx for lpu course cse121 o
 
GBSN - Microbiology (Unit 3)
GBSN - Microbiology (Unit 3)GBSN - Microbiology (Unit 3)
GBSN - Microbiology (Unit 3)
 
Justdial Call Girls In Indirapuram, Ghaziabad, 8800357707 Escorts Service
Justdial Call Girls In Indirapuram, Ghaziabad, 8800357707 Escorts ServiceJustdial Call Girls In Indirapuram, Ghaziabad, 8800357707 Escorts Service
Justdial Call Girls In Indirapuram, Ghaziabad, 8800357707 Escorts Service
 

Introduction to R for Quantitative Research

  • 1. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Introduction to R for Quantitative Research Parthasarathi Edupally CRISIL, GR & A NBT@CRISIL, Nov 2014
  • 2. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Outline 1. Motivation and Objective What is this module about ? Why learn R ?
  • 3. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Outline 1. Motivation and Objective What is this module about ? Why learn R ? 2. Fundamentals Language Foundations Functions Data
  • 4. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Outline 1. Motivation and Objective What is this module about ? Why learn R ? 2. Fundamentals Language Foundations Functions Data 3. Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming
  • 5. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Outline 1. Motivation and Objective What is this module about ? Why learn R ? 2. Fundamentals Language Foundations Functions Data 3. Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming 4. Further Reading and References Advanced Topics References
  • 6. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Outline 1. Motivation and Objective What is this module about ? Why learn R ? 2. Fundamentals Language Foundations Functions Data 3. Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming 4. Further Reading and References Advanced Topics References 5. Thank You
  • 7. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You What is this module about ?
  • 8. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You What is this module about ? An introduction to R statistical software - Just an Intro! Understanding of language fundamentals than lot of language specific details
  • 9. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You What is this module about ? An introduction to R statistical software - Just an Intro! Understanding of language fundamentals than lot of language specific details Targeted people - Analysts with no formal software background
  • 10. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You What is this module about ? An introduction to R statistical software - Just an Intro! Understanding of language fundamentals than lot of language specific details Targeted people - Analysts with no formal software background Just to give a head start in learning and using R for analysis.
  • 11. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Why learn R ?
  • 12. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Why learn R ? This is why you should : Its open source, anyone can replicate your results A massive set of packages for statistical analysis, machine learning etc Specially designed for statistics and Data analysis with features like missing values, Dataframes, subsetting etc
  • 13. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Why learn R ? This is why you should : Its open source, anyone can replicate your results A massive set of packages for statistical analysis, machine learning etc Specially designed for statistics and Data analysis with features like missing values, Dataframes, subsetting etc Strong foundations in functional programming Designed to connect to low level languages for high performance
  • 14. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Why learn R ? This is why you should : Its open source, anyone can replicate your results A massive set of packages for statistical analysis, machine learning etc Specially designed for statistics and Data analysis with features like missing values, Dataframes, subsetting etc Strong foundations in functional programming Designed to connect to low level languages for high performance Some drawbacks :
  • 15. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Why learn R ? This is why you should : Its open source, anyone can replicate your results A massive set of packages for statistical analysis, machine learning etc Specially designed for statistics and Data analysis with features like missing values, Dataframes, subsetting etc Strong foundations in functional programming Designed to connect to low level languages for high performance Some drawbacks : Most of the code is written in haste to solve a pressing problem at hand, so code is less elegant, less faster and less easier to understand. It is not particularly fast programming language.
  • 16. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Expressions
  • 17. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Expressions Most often when we write code we are writing an expression Expression describes a computation and evaluates to a value
  • 18. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Expressions Most often when we write code we are writing an expression Expression describes a computation and evaluates to a value In Math - addition, division etc All expressions can be represented by a function notation - It is the most general representation
  • 19. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Expressions Most often when we write code we are writing an expression Expression describes a computation and evaluates to a value In Math - addition, division etc All expressions can be represented by a function notation - It is the most general representation Types of expressions : primitive expression – Numbers, Names, Strings call expressions – operator(op1; op2)
  • 20. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Expressions Most often when we write code we are writing an expression Expression describes a computation and evaluates to a value In Math - addition, division etc All expressions can be represented by a function notation - It is the most general representation Types of expressions : primitive expression – Numbers, Names, Strings call expressions – operator(op1; op2) Demo
  • 21. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Statements
  • 22. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Statements They are used to perform an action, they don’t evaluate to value
  • 23. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Statements They are used to perform an action, they don’t evaluate to value There can be conditional and iterative statements
  • 24. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Statements They are used to perform an action, they don’t evaluate to value There can be conditional and iterative statements Conditional statements: if-elseif-else
  • 25. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Statements They are used to perform an action, they don’t evaluate to value There can be conditional and iterative statements Conditional statements: if-elseif-else Iterative statements: for() fg while() fg
  • 26. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Statements They are used to perform an action, they don’t evaluate to value There can be conditional and iterative statements Conditional statements: if-elseif-else Iterative statements: for() fg while() fg Demo
  • 27. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Environments
  • 28. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Environments They are used by the interpreter to understand the scoping rules i.e., where to look for variables and functions by names
  • 29. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Environments They are used by the interpreter to understand the scoping rules i.e., where to look for variables and functions by names Job of an environment is to bind set of names to set of values (a bag of names) Each name points to an object stored elsewhere in memory
  • 30. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Environments They are used by the interpreter to understand the scoping rules i.e., where to look for variables and functions by names Job of an environment is to bind set of names to set of values (a bag of names) Each name points to an object stored elsewhere in memory Developers mainly use them while writing packages to avoid naming conflicts. .
  • 31. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Environments They are used by the interpreter to understand the scoping rules i.e., where to look for variables and functions by names Job of an environment is to bind set of names to set of values (a bag of names) Each name points to an object stored elsewhere in memory Developers mainly use them while writing packages to avoid naming conflicts. .
  • 32. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You User-defined functions
  • 33. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You User-defined functions R is designed to support functional programming style. So most of the computation we do will be a function call.
  • 34. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You User-defined functions R is designed to support functional programming style. So most of the computation we do will be a function call. Life cycle of user-defined function : Function definition - name bound to that function in current environment (enclosing environment) Function call- A new environment(calling environment) is created and call expression is executed
  • 35. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You User-defined functions R is designed to support functional programming style. So most of the computation we do will be a function call. Life cycle of user-defined function : Function definition - name bound to that function in current environment (enclosing environment) Function call- A new environment(calling environment) is created and call expression is executed Please note there is execution environment, environment in which function was called.
  • 36. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You User-defined functions R is designed to support functional programming style. So most of the computation we do will be a function call. Life cycle of user-defined function : Function definition - name bound to that function in current environment (enclosing environment) Function call- A new environment(calling environment) is created and call expression is executed Please note there is execution environment, environment in which function was called. Demo
  • 37. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Data Type
  • 38. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Data Type Every data will have a type associated with it. Basic types in R are - Integer, Double, Character and factor.
  • 39. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Data Type Every data will have a type associated with it. Basic types in R are - Integer, Double, Character and factor. Native data types : Have primitive expressions that evaluate to values of these types Built-in functions, operators, methods to manipulate those values
  • 40. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Data Type Every data will have a type associated with it. Basic types in R are - Integer, Double, Character and factor. Native data types : Have primitive expressions that evaluate to values of these types Built-in functions, operators, methods to manipulate those values We restrict data to be some number, vector or matrix with values in them. But Data is much more general and powerful than this. Important idea in computer science is Code is also data. So a piece of code which does square root computation is data and can have type associated with it.
  • 41. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Data Type Every data will have a type associated with it. Basic types in R are - Integer, Double, Character and factor. Native data types : Have primitive expressions that evaluate to values of these types Built-in functions, operators, methods to manipulate those values We restrict data to be some number, vector or matrix with values in them. But Data is much more general and powerful than this. Important idea in computer science is Code is also data. So a piece of code which does square root computation is data and can have type associated with it. These lead us to Abstract data types (Data structures), which are based on the concept of objects.
  • 42. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Objects
  • 43. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Objects Objects represent information - consist of data and behaviour. So they are more powerful than just data.
  • 44. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Objects Objects represent information - consist of data and behaviour. So they are more powerful than just data. They can represent - things, properties, Interactions, processes
  • 45. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Objects Objects represent information - consist of data and behaviour. So they are more powerful than just data. They can represent - things, properties, Interactions, processes Type of an object is called class A class is some collection of methods(functions) and behaviour conditions defined in it.
  • 46. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Data structures
  • 47. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Data structures These are abstract data types defined in R and can be organised according to their dimensionality and whether they are homogeneous.
  • 48. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Data structures These are abstract data types defined in R and can be organised according to their dimensionality and whether they are homogeneous. One dimensional structures - Atomic vectors, lists Two dimensional structures - Matrices, Data frames Multidimensional - Arrays
  • 49. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Data structures These are abstract data types defined in R and can be organised according to their dimensionality and whether they are homogeneous. One dimensional structures - Atomic vectors, lists Two dimensional structures - Matrices, Data frames Multidimensional - Arrays A data frame is the most common way of storing data in R, and makes data analysis easier
  • 50. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Data structures These are abstract data types defined in R and can be organised according to their dimensionality and whether they are homogeneous. One dimensional structures - Atomic vectors, lists Two dimensional structures - Matrices, Data frames Multidimensional - Arrays A data frame is the most common way of storing data in R, and makes data analysis easier Demo
  • 51. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Simple Rules for efficiency
  • 52. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Simple Rules for efficiency Folder Structure : Always maintain a consistent folder structure for all projects.
  • 53. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Simple Rules for efficiency Folder Structure : Always maintain a consistent folder structure for all projects. Naming: Give sensible names to files and variables Always use comments to describe every line or group of lines of code. indentation : Follow consistent and creative indentations while writing code.
  • 54. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Simple Rules for efficiency Folder Structure : Always maintain a consistent folder structure for all projects. Naming: Give sensible names to files and variables Always use comments to describe every line or group of lines of code. indentation : Follow consistent and creative indentations while writing code. README : Draft README file in every folder. These have to give brief description of files in the current folder.
  • 55. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Subsetting
  • 56. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Subsetting Subsetting allows us to succinctly express complex operations on large datasets. They are very useful in data cleaning, which is first step in data analysis. It basically involves selecting and modifying specific portions of data.
  • 57. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Subsetting Subsetting allows us to succinctly express complex operations on large datasets. They are very useful in data cleaning, which is first step in data analysis. It basically involves selecting and modifying specific portions of data. Subsetting Atomic vectors, lists, matrices, arrays and data frames
  • 58. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Subsetting Subsetting allows us to succinctly express complex operations on large datasets. They are very useful in data cleaning, which is first step in data analysis. It basically involves selecting and modifying specific portions of data. Subsetting Atomic vectors, lists, matrices, arrays and data frames Demo
  • 59. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Functional Programming Paradigm
  • 60. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Functional Programming Paradigm R at heart is a functional programming language - gives tools for creation and manipulation of functions.
  • 61. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Functional Programming Paradigm R at heart is a functional programming language - gives tools for creation and manipulation of functions. FP allows to write code clearly, concisely and at high level of abstraction.
  • 62. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Functional Programming Paradigm R at heart is a functional programming language - gives tools for creation and manipulation of functions. FP allows to write code clearly, concisely and at high level of abstraction. It supports reusable software components. Encourages the use of formal verification.
  • 63. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Functional Programming Paradigm R at heart is a functional programming language - gives tools for creation and manipulation of functions. FP allows to write code clearly, concisely and at high level of abstraction. It supports reusable software components. Encourages the use of formal verification. With latest trend of Multicore processors, FP is very amenable to parallel programming.
  • 64. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Important Advanced Topics
  • 65. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Important Advanced Topics Object systems in R
  • 66. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Important Advanced Topics Object systems in R Basic Version Control with GitHub
  • 67. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Important Advanced Topics Object systems in R Basic Version Control with GitHub More Advanced Subsetting
  • 68. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Important Advanced Topics Object systems in R Basic Version Control with GitHub More Advanced Subsetting Functional programming paradigm
  • 69. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Important Advanced Topics Object systems in R Basic Version Control with GitHub More Advanced Subsetting Functional programming paradigm Memory usage in R
  • 70. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Important Advanced Topics Object systems in R Basic Version Control with GitHub More Advanced Subsetting Functional programming paradigm Memory usage in R Using lower level languages for better performance where ever required in R
  • 71. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Resources
  • 72. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Resources Advanced R by Hadley Wickham
  • 73. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Resources Advanced R by Hadley Wickham Structure and Interpretation of Computer Programs - Berkley webcast(CS61A, Fall 2013)
  • 74. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You Resources Advanced R by Hadley Wickham Structure and Interpretation of Computer Programs - Berkley webcast(CS61A, Fall 2013) R package documentation
  • 75. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You
  • 76. Introduction to R for Quantitative Research Parthasarathi Edupally Motivation and Objective What is this module about ? Why learn R ? Fundamentals Language Foundations Functions Data Essentials Basic Coding Etiquttes Subsetting Basic Functional Programming Further Reading and References Advanced Topics References Thank You “To understand computations in R, two slogans are helpful: Everything that exists is an object. Everything that happens is a function call.” John Chambers (Inventor of R).