SlideShare a Scribd company logo
Prof. Neeraj Bhargava
Pramod Singh Rathore
Department of Computer Science
School of Engineering & System Sciences,
MDS University Ajmer, Rajasthan, India
1
Data types in R
Session Objectives
 What is data type in R ?
 How to handle data types in R
2
Data types in R
3
Data types can be listed as
• Vectors
• Lists
• Matrices
• Data Frames
• Factors
Vectors
4
Vectors is a list of main components which have same data types
Vectors can be define by using c() in R
Members in a vectors are officially called components
Vectors scan be of integer, numeric, character or logical types.
Vectors Index
5
Values in a vector can be retrieved by declaring an index inside a single
square bracket[]
Eg
If 3rd element Is retrieved
C[3]
C[3:5]
If the index is negative , it would strip the member whose position has the
same absolute value a s the negative index
Vectors Index
6
Numeric vector index: A new vector can be sliced from a give n vector with a
numeric index, vector, which consist of member positons of the original vector
to be retrieved
Eg
Name of vector[2,3]
Logical vector index : A new vector can be sliced from a given vector with a
logical index vector, which ahs the same is length as the original vector. Its
members are TRUE if the corresponding members in the original vector are to
be includes in the slice, and FALSE if otherwise
Matrics
7
A Matrix is a collection of data elements arranged in a two dimensional
rectangular layout. The following is an example of a matrix with 2 rows and 3
columns
[2 34 6]
All the elements of matrices has to be af same type
Lists
8
List is similar as vector
It is a data structure have components of mixed data types
Data frames
9
A data frame is used fro storing data tables
It is a special case of list which as each components of equal length
Each component form the column and contents of the components form the
rows
Data frame can be define by data.frame() function
Factors
10
Factor is a data structure used for fields that takes only predefined, finite
number of values (catergorialc data)
Factor variable will always have levels
While using data.frame() all the character data are converted into factor
How to handle vector in R
11
c(2,3,4) output : 2 3 4
Class(c(2,3,4)) numeric
C(2,3,”pramod”) “2” “3” “pramod”
class(C(2,3,”pramod”)) character
Length(c(2,3,4)) 3
a = c(2,3,4)
b= c(“a”,”b”,”c”)
vec=c(a,b) “2”,”3”,”4”,”a”,”b”,”c”
class(vec) character
Class(a) numeric
How to handle vector in R
12
A= c(1,2,3,4)
b= c(-1,-2,-3,-4)
Vect=a+b 0 0 0 0
v1=c(1,2,3)
v2=c(4,5,6,7)
v3=v1+v2 warning message
5 7 9 8 recycling rule
How to handle vector in R
13
v4= c(1:10)
v4[5] 5
V4[-5] 1 2 3 4 6 7 8 9 10
V4(3:5) 3 4 5
V4[c(3:5),10] 3 4 5 10 range indexing
Assignment 1
 What is data types in R?
 Explain each data type with suitable example
14
Queries ????
15
16

More Related Content

What's hot

R Data Structures (Part 1)
R Data Structures (Part 1)R Data Structures (Part 1)
R Data Structures (Part 1)
Victor Ordu
 
Introduction of data structures and algorithms
Introduction of data structures and algorithmsIntroduction of data structures and algorithms
Introduction of data structures and algorithms
VinayKumarV16
 
Introduction To Data Structures.
Introduction To Data Structures.Introduction To Data Structures.
Introduction To Data Structures.
Education Front
 
data structure
data structuredata structure
data structure
hashim102
 
Data structure using c++
Data structure using c++Data structure using c++
Data structure using c++
Prof. Dr. K. Adisesha
 
Data structure
Data structureData structure
Data structure
Prof. Dr. K. Adisesha
 
Data structures
Data structuresData structures
Data structures
MADHAVASAIYENDUVA
 
Computer Science-Data Structures :Abstract DataType (ADT)
Computer Science-Data Structures :Abstract DataType (ADT)Computer Science-Data Structures :Abstract DataType (ADT)
Computer Science-Data Structures :Abstract DataType (ADT)
St Mary's College,Thrissur,Kerala
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structure
adeel hamid
 
Data Structures
Data StructuresData Structures
Data Structures
Prof. Dr. K. Adisesha
 
DATA STRUCTURE
DATA STRUCTUREDATA STRUCTURE
DATA STRUCTURE
Rohit Rai
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
Poojith Chowdhary
 
Abstract data types (adt) intro to data structure part 2
Abstract data types (adt)   intro to data structure part 2Abstract data types (adt)   intro to data structure part 2
Abstract data types (adt) intro to data structure part 2
Self-Employed
 
Presentation on Data Structure
Presentation on Data StructurePresentation on Data Structure
Presentation on Data Structure
A. N. M. Jubaer
 
M v bramhananda reddy dsa complete notes
M v bramhananda reddy dsa complete notesM v bramhananda reddy dsa complete notes
M v bramhananda reddy dsa complete notes
Malikireddy Bramhananda Reddy
 
Chapter 8: tree data structure
Chapter 8:  tree data structureChapter 8:  tree data structure
Chapter 8: tree data structure
Mahmoud Alfarra
 
Lecture 1 data structures and algorithms
Lecture 1 data structures and algorithmsLecture 1 data structures and algorithms
Lecture 1 data structures and algorithms
Aakash deep Singhal
 
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada ReddyDatastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
Malikireddy Bramhananda Reddy
 
Data structures
Data structuresData structures
Ii pu cs practical viva voce questions
Ii pu cs  practical viva voce questionsIi pu cs  practical viva voce questions
Ii pu cs practical viva voce questions
Prof. Dr. K. Adisesha
 

What's hot (20)

R Data Structures (Part 1)
R Data Structures (Part 1)R Data Structures (Part 1)
R Data Structures (Part 1)
 
Introduction of data structures and algorithms
Introduction of data structures and algorithmsIntroduction of data structures and algorithms
Introduction of data structures and algorithms
 
Introduction To Data Structures.
Introduction To Data Structures.Introduction To Data Structures.
Introduction To Data Structures.
 
data structure
data structuredata structure
data structure
 
Data structure using c++
Data structure using c++Data structure using c++
Data structure using c++
 
Data structure
Data structureData structure
Data structure
 
Data structures
Data structuresData structures
Data structures
 
Computer Science-Data Structures :Abstract DataType (ADT)
Computer Science-Data Structures :Abstract DataType (ADT)Computer Science-Data Structures :Abstract DataType (ADT)
Computer Science-Data Structures :Abstract DataType (ADT)
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structure
 
Data Structures
Data StructuresData Structures
Data Structures
 
DATA STRUCTURE
DATA STRUCTUREDATA STRUCTURE
DATA STRUCTURE
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
Abstract data types (adt) intro to data structure part 2
Abstract data types (adt)   intro to data structure part 2Abstract data types (adt)   intro to data structure part 2
Abstract data types (adt) intro to data structure part 2
 
Presentation on Data Structure
Presentation on Data StructurePresentation on Data Structure
Presentation on Data Structure
 
M v bramhananda reddy dsa complete notes
M v bramhananda reddy dsa complete notesM v bramhananda reddy dsa complete notes
M v bramhananda reddy dsa complete notes
 
Chapter 8: tree data structure
Chapter 8:  tree data structureChapter 8:  tree data structure
Chapter 8: tree data structure
 
Lecture 1 data structures and algorithms
Lecture 1 data structures and algorithmsLecture 1 data structures and algorithms
Lecture 1 data structures and algorithms
 
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada ReddyDatastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
 
Data structures
Data structuresData structures
Data structures
 
Ii pu cs practical viva voce questions
Ii pu cs  practical viva voce questionsIi pu cs  practical viva voce questions
Ii pu cs practical viva voce questions
 

Similar to Data types in r

R training3
R training3R training3
R training3
Hellen Gakuruh
 
How to handling strings in r
How to handling strings in rHow to handling strings in r
How to handling strings in r
Pramod Rathore
 
R교육1
R교육1R교육1
R교육1
Kangwook Lee
 
2D Array
2D Array 2D Array
2D Array
Ehatsham Riaz
 
8074.pdf
8074.pdf8074.pdf
8074.pdf
BAna36
 
Arrays In C Programming Explained
Arrays In C Programming ExplainedArrays In C Programming Explained
Arrays In C Programming Explained
Simplilearn
 
R Programming.pptx
R Programming.pptxR Programming.pptx
R Programming.pptx
kalai75
 
Array
ArrayArray
Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive
Raj Naik
 
Unit 1 introduction to data structure
Unit 1   introduction to data structureUnit 1   introduction to data structure
Unit 1 introduction to data structure
kalyanineve
 
Functions, Strings ,Storage classes in C
 Functions, Strings ,Storage classes in C Functions, Strings ,Storage classes in C
Functions, Strings ,Storage classes in C
arshpreetkaur07
 
Introduction to Arrays in C
Introduction to Arrays in CIntroduction to Arrays in C
Introduction to Arrays in C
Thesis Scientist Private Limited
 
Array Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional arrayArray Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional array
imtiazalijoono
 
array-191103180006.pdf
array-191103180006.pdfarray-191103180006.pdf
array-191103180006.pdf
HEMAHEMS5
 
Data Types and Structures in R
Data Types and Structures in RData Types and Structures in R
Data Types and Structures in R
Rupak Roy
 
Basic of array and data structure, data structure basics, array, address calc...
Basic of array and data structure, data structure basics, array, address calc...Basic of array and data structure, data structure basics, array, address calc...
Basic of array and data structure, data structure basics, array, address calc...
nsitlokeshjain
 
Description of data
Description of dataDescription of data
Description of data
Johnna Mae Yodico
 
Unit4 Slides
Unit4 SlidesUnit4 Slides
Unit4 Slides
Rakesh Roshan
 
arrays.docx
arrays.docxarrays.docx
unit1Intro_final.pptx
unit1Intro_final.pptxunit1Intro_final.pptx
unit1Intro_final.pptx
DEEPAK948083
 

Similar to Data types in r (20)

R training3
R training3R training3
R training3
 
How to handling strings in r
How to handling strings in rHow to handling strings in r
How to handling strings in r
 
R교육1
R교육1R교육1
R교육1
 
2D Array
2D Array 2D Array
2D Array
 
8074.pdf
8074.pdf8074.pdf
8074.pdf
 
Arrays In C Programming Explained
Arrays In C Programming ExplainedArrays In C Programming Explained
Arrays In C Programming Explained
 
R Programming.pptx
R Programming.pptxR Programming.pptx
R Programming.pptx
 
Array
ArrayArray
Array
 
Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive
 
Unit 1 introduction to data structure
Unit 1   introduction to data structureUnit 1   introduction to data structure
Unit 1 introduction to data structure
 
Functions, Strings ,Storage classes in C
 Functions, Strings ,Storage classes in C Functions, Strings ,Storage classes in C
Functions, Strings ,Storage classes in C
 
Introduction to Arrays in C
Introduction to Arrays in CIntroduction to Arrays in C
Introduction to Arrays in C
 
Array Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional arrayArray Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional array
 
array-191103180006.pdf
array-191103180006.pdfarray-191103180006.pdf
array-191103180006.pdf
 
Data Types and Structures in R
Data Types and Structures in RData Types and Structures in R
Data Types and Structures in R
 
Basic of array and data structure, data structure basics, array, address calc...
Basic of array and data structure, data structure basics, array, address calc...Basic of array and data structure, data structure basics, array, address calc...
Basic of array and data structure, data structure basics, array, address calc...
 
Description of data
Description of dataDescription of data
Description of data
 
Unit4 Slides
Unit4 SlidesUnit4 Slides
Unit4 Slides
 
arrays.docx
arrays.docxarrays.docx
arrays.docx
 
unit1Intro_final.pptx
unit1Intro_final.pptxunit1Intro_final.pptx
unit1Intro_final.pptx
 

More from Pramod Rathore

Restoration by spatial filtering
Restoration by spatial filteringRestoration by spatial filtering
Restoration by spatial filtering
Pramod Rathore
 
Image restoration
Image restorationImage restoration
Image restoration
Pramod Rathore
 
Homomorphic filtering
Homomorphic filteringHomomorphic filtering
Homomorphic filtering
Pramod Rathore
 
Sharpening filtering
Sharpening filteringSharpening filtering
Sharpening filtering
Pramod Rathore
 
Image enhancement in frequency domain
Image enhancement in frequency domainImage enhancement in frequency domain
Image enhancement in frequency domain
Pramod Rathore
 
Image enhancement in fourier transform part ii
Image enhancement in fourier transform  part iiImage enhancement in fourier transform  part ii
Image enhancement in fourier transform part ii
Pramod Rathore
 
Image enhancement in fourier transform
Image enhancement in fourier transformImage enhancement in fourier transform
Image enhancement in fourier transform
Pramod Rathore
 
Control statements
Control statementsControl statements
Control statements
Pramod Rathore
 
Basic image operation
Basic image operationBasic image operation
Basic image operation
Pramod Rathore
 
Smoothing spatial filtering
Smoothing spatial filteringSmoothing spatial filtering
Smoothing spatial filtering
Pramod Rathore
 
Handle list in r
Handle list in rHandle list in r
Handle list in r
Pramod Rathore
 
Spatial filtering
Spatial filteringSpatial filtering
Spatial filtering
Pramod Rathore
 
6.histogram processing
6.histogram processing6.histogram processing
6.histogram processing
Pramod Rathore
 
5.image enhancement in spatial domain copy - copy
5.image enhancement in spatial domain   copy - copy5.image enhancement in spatial domain   copy - copy
5.image enhancement in spatial domain copy - copy
Pramod Rathore
 
4.image enhancement in spatial domain copy
4.image enhancement in spatial domain   copy4.image enhancement in spatial domain   copy
4.image enhancement in spatial domain copy
Pramod Rathore
 
Issues in machine learning
Issues in machine learningIssues in machine learning
Issues in machine learning
Pramod Rathore
 
R programming
R programmingR programming
R programming
Pramod Rathore
 
Image enhancement in spatial domain
Image enhancement in spatial domainImage enhancement in spatial domain
Image enhancement in spatial domain
Pramod Rathore
 
2.image enhancement
2.image enhancement2.image enhancement
2.image enhancement
Pramod Rathore
 
Id3
Id3Id3

More from Pramod Rathore (20)

Restoration by spatial filtering
Restoration by spatial filteringRestoration by spatial filtering
Restoration by spatial filtering
 
Image restoration
Image restorationImage restoration
Image restoration
 
Homomorphic filtering
Homomorphic filteringHomomorphic filtering
Homomorphic filtering
 
Sharpening filtering
Sharpening filteringSharpening filtering
Sharpening filtering
 
Image enhancement in frequency domain
Image enhancement in frequency domainImage enhancement in frequency domain
Image enhancement in frequency domain
 
Image enhancement in fourier transform part ii
Image enhancement in fourier transform  part iiImage enhancement in fourier transform  part ii
Image enhancement in fourier transform part ii
 
Image enhancement in fourier transform
Image enhancement in fourier transformImage enhancement in fourier transform
Image enhancement in fourier transform
 
Control statements
Control statementsControl statements
Control statements
 
Basic image operation
Basic image operationBasic image operation
Basic image operation
 
Smoothing spatial filtering
Smoothing spatial filteringSmoothing spatial filtering
Smoothing spatial filtering
 
Handle list in r
Handle list in rHandle list in r
Handle list in r
 
Spatial filtering
Spatial filteringSpatial filtering
Spatial filtering
 
6.histogram processing
6.histogram processing6.histogram processing
6.histogram processing
 
5.image enhancement in spatial domain copy - copy
5.image enhancement in spatial domain   copy - copy5.image enhancement in spatial domain   copy - copy
5.image enhancement in spatial domain copy - copy
 
4.image enhancement in spatial domain copy
4.image enhancement in spatial domain   copy4.image enhancement in spatial domain   copy
4.image enhancement in spatial domain copy
 
Issues in machine learning
Issues in machine learningIssues in machine learning
Issues in machine learning
 
R programming
R programmingR programming
R programming
 
Image enhancement in spatial domain
Image enhancement in spatial domainImage enhancement in spatial domain
Image enhancement in spatial domain
 
2.image enhancement
2.image enhancement2.image enhancement
2.image enhancement
 
Id3
Id3Id3
Id3
 

Recently uploaded

How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 

Recently uploaded (20)

How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 

Data types in r

  • 1. Prof. Neeraj Bhargava Pramod Singh Rathore Department of Computer Science School of Engineering & System Sciences, MDS University Ajmer, Rajasthan, India 1 Data types in R
  • 2. Session Objectives  What is data type in R ?  How to handle data types in R 2
  • 3. Data types in R 3 Data types can be listed as • Vectors • Lists • Matrices • Data Frames • Factors
  • 4. Vectors 4 Vectors is a list of main components which have same data types Vectors can be define by using c() in R Members in a vectors are officially called components Vectors scan be of integer, numeric, character or logical types.
  • 5. Vectors Index 5 Values in a vector can be retrieved by declaring an index inside a single square bracket[] Eg If 3rd element Is retrieved C[3] C[3:5] If the index is negative , it would strip the member whose position has the same absolute value a s the negative index
  • 6. Vectors Index 6 Numeric vector index: A new vector can be sliced from a give n vector with a numeric index, vector, which consist of member positons of the original vector to be retrieved Eg Name of vector[2,3] Logical vector index : A new vector can be sliced from a given vector with a logical index vector, which ahs the same is length as the original vector. Its members are TRUE if the corresponding members in the original vector are to be includes in the slice, and FALSE if otherwise
  • 7. Matrics 7 A Matrix is a collection of data elements arranged in a two dimensional rectangular layout. The following is an example of a matrix with 2 rows and 3 columns [2 34 6] All the elements of matrices has to be af same type
  • 8. Lists 8 List is similar as vector It is a data structure have components of mixed data types
  • 9. Data frames 9 A data frame is used fro storing data tables It is a special case of list which as each components of equal length Each component form the column and contents of the components form the rows Data frame can be define by data.frame() function
  • 10. Factors 10 Factor is a data structure used for fields that takes only predefined, finite number of values (catergorialc data) Factor variable will always have levels While using data.frame() all the character data are converted into factor
  • 11. How to handle vector in R 11 c(2,3,4) output : 2 3 4 Class(c(2,3,4)) numeric C(2,3,”pramod”) “2” “3” “pramod” class(C(2,3,”pramod”)) character Length(c(2,3,4)) 3 a = c(2,3,4) b= c(“a”,”b”,”c”) vec=c(a,b) “2”,”3”,”4”,”a”,”b”,”c” class(vec) character Class(a) numeric
  • 12. How to handle vector in R 12 A= c(1,2,3,4) b= c(-1,-2,-3,-4) Vect=a+b 0 0 0 0 v1=c(1,2,3) v2=c(4,5,6,7) v3=v1+v2 warning message 5 7 9 8 recycling rule
  • 13. How to handle vector in R 13 v4= c(1:10) v4[5] 5 V4[-5] 1 2 3 4 6 7 8 9 10 V4(3:5) 3 4 5 V4[c(3:5),10] 3 4 5 10 range indexing
  • 14. Assignment 1  What is data types in R?  Explain each data type with suitable example 14
  • 16. 16