SlideShare a Scribd company logo
6
Most read
8
Most read
10
Most read
Data Types
SachinSL
sachinsl06@gmail.com
Beauty of R Data Types
OBJECT
R - objects
In R programming language,
• Variables are not declared as some data types
• Variables are assigned with R – objects
• The data type of R-object becomes the data
type of the variable.
NOTE: -> everything is just R - object
Basic Data Types in R
R Programming works with various data types,
–Scalars
–Vectors
–Matrices
–Factors
–Data frames
–Lists
Basic Types
• Numeric
• Integers
• Logical
• Characters
VECTORS
• A vector is a one-dimensional array.
• We can create a vector with all the basic data
type we learnt before.
• The simplest way to build a vector in R, is to
use the ‘ c ‘ command.
Ex: num_vec <- c(1, 2, 3, 4)
chr_vec <- c(“a”, ”b”, ”c”)
MATRIX
• A matrix is a 2-dimensional array that has m
number of rows and n number of columns.
• In other words, matrix is a combination of two or
more vectors with the same data type.
NOTE: In R, more than two-dimensional arrays
can also be created
Semantic:
matrix( data, nrow, ncol, byrow = TRUE/FALSE)
FACTORS
• Factor is a variable in R which take on a limited
number of different values; such variables are
often referred to as categorical variables.
• In other words, R stores categorical variables into
a factor.
Semantic:
factor(x = character(), levels, labels = levels,
ordered = is.ordered(x) )
Data frames
• A data frame is a list of vectors which are of
equal length.
• A matrix contains only one type of data, while
a data frame accepts different data types
(numeric, character, factor, etc.).
Semantic:
data.frame( df, stringsAsFactors = TRUE)
Lists
• A list store many kinds of object in the order expected.
• It can include matrices, vectors data frames or lists.
• A list is similar; we can store a collection of objects and
use them when we need them.
Semantic:
list( element_1, element_2, ... )
arguments: -element_1: store any type of R object -...:
pass as many objects as specifying.
Each object needs to be separated by a comma.

More Related Content

PPTX
Exploratory Data Analysis
PDF
Data Types and Structures in R
PDF
Introduction to R Programming
PPTX
R programming
PPTX
Data and its Types
PPTX
data analysis techniques and statistical softwares
PPTX
Data Management in R
PPT
Data Processing-Presentation
Exploratory Data Analysis
Data Types and Structures in R
Introduction to R Programming
R programming
Data and its Types
data analysis techniques and statistical softwares
Data Management in R
Data Processing-Presentation

What's hot (20)

PDF
PPTX
R programming
PPTX
PPTX
Point estimation
PPTX
Measures of-central-tendency
PPTX
MATRICES AND ITS TYPE
PPTX
Data analysis with R
PPT
Artificial intelligence Prolog Language
PDF
R data-import, data-export
 
PDF
Statistics For Data Science | Statistics Using R Programming Language | Hypot...
PPTX
A.1 properties of point estimators
PDF
R data types
PPTX
Measure of Central Tendency (Mean, Median, Mode and Quantiles)
PPTX
Step By Step Guide to Learn R
PDF
Import Data using R
PPTX
Z test, f-test,etc
PDF
Descriptive Statistics with R
PPTX
Range, quartiles, and interquartile range
PPTX
Chapter 6 simple regression and correlation
PDF
Introduction to R and R Studio
R programming
Point estimation
Measures of-central-tendency
MATRICES AND ITS TYPE
Data analysis with R
Artificial intelligence Prolog Language
R data-import, data-export
 
Statistics For Data Science | Statistics Using R Programming Language | Hypot...
A.1 properties of point estimators
R data types
Measure of Central Tendency (Mean, Median, Mode and Quantiles)
Step By Step Guide to Learn R
Import Data using R
Z test, f-test,etc
Descriptive Statistics with R
Range, quartiles, and interquartile range
Chapter 6 simple regression and correlation
Introduction to R and R Studio
Ad

Similar to R data types (20)

PPTX
Introduction to R - Basics of R programming, Data structures.pptx
PPTX
Data Types of R.pptx
PDF
R Programming - part 1.pdf
PPTX
Introduction to R programming Language.pptx
PPTX
Introduction to R _IMPORTANT FOR DATA ANALYTICS
PPTX
Unit-5 BDS.pptx on basics of data science
PDF
R training2
PDF
Day 1b R structures objects.pptx
PPT
R programming by ganesh kavhar
PDF
3 Data Structure in R
PDF
R training3
PPT
Basics of R-Programming with example.ppt
PPT
Basocs of statistics with R-Programming.ppt
PPT
R-Programming.ppt it is based on R programming language
PPTX
Big Data Mining in Indian Economic Survey 2017
PDF
Introduction to R - by Chameera Dedduwage
PPTX
Unit 1 - R Programming (Part 2).pptx
PPT
R Programming for Statistical Applications
PPT
R-programming with example representation.ppt
ODP
Introduction to the language R
Introduction to R - Basics of R programming, Data structures.pptx
Data Types of R.pptx
R Programming - part 1.pdf
Introduction to R programming Language.pptx
Introduction to R _IMPORTANT FOR DATA ANALYTICS
Unit-5 BDS.pptx on basics of data science
R training2
Day 1b R structures objects.pptx
R programming by ganesh kavhar
3 Data Structure in R
R training3
Basics of R-Programming with example.ppt
Basocs of statistics with R-Programming.ppt
R-Programming.ppt it is based on R programming language
Big Data Mining in Indian Economic Survey 2017
Introduction to R - by Chameera Dedduwage
Unit 1 - R Programming (Part 2).pptx
R Programming for Statistical Applications
R-programming with example representation.ppt
Introduction to the language R
Ad

More from Teachers Mitraa (15)

PPTX
R installing
PPTX
R introduction
PPTX
R joins on dataframes
PPTX
R-script
PPTX
E library in the 21st century
PPTX
Impact of Crises on economy
PDF
Mobile & Web based teaching and learning
PPTX
M learning post covid impact
PPTX
Data analysis and interpretation
PPTX
Reseach Paper and Literature Review
PPTX
Sales management
PPTX
Trans shipment problem
PPT
Types of research mba mr
PPTX
Regression analysis
PPTX
Law of contract
R installing
R introduction
R joins on dataframes
R-script
E library in the 21st century
Impact of Crises on economy
Mobile & Web based teaching and learning
M learning post covid impact
Data analysis and interpretation
Reseach Paper and Literature Review
Sales management
Trans shipment problem
Types of research mba mr
Regression analysis
Law of contract

Recently uploaded (20)

PDF
Introduction to Business Data Analytics.
PPT
Reliability_Chapter_ presentation 1221.5784
PPT
Quality review (1)_presentation of this 21
PPTX
CEE 2 REPORT G7.pptxbdbshjdgsgjgsjfiuhsd
PPTX
Database Infoormation System (DBIS).pptx
PDF
168300704-gasification-ppt.pdfhghhhsjsjhsuxush
PPTX
Introduction to Basics of Ethical Hacking and Penetration Testing -Unit No. 1...
PPTX
Computer network topology notes for revision
PPTX
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
PDF
.pdf is not working space design for the following data for the following dat...
PPTX
Acceptance and paychological effects of mandatory extra coach I classes.pptx
PDF
TRAFFIC-MANAGEMENT-AND-ACCIDENT-INVESTIGATION-WITH-DRIVING-PDF-FILE.pdf
PPTX
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
PPTX
05. PRACTICAL GUIDE TO MICROSOFT EXCEL.pptx
PPTX
Data_Analytics_and_PowerBI_Presentation.pptx
PPTX
advance b rammar.pptxfdgdfgdfsgdfgsdgfdfgdfgsdfgdfgdfg
PPTX
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
PDF
“Getting Started with Data Analytics Using R – Concepts, Tools & Case Studies”
PPT
Chapter 3 METAL JOINING.pptnnnnnnnnnnnnn
Introduction to Business Data Analytics.
Reliability_Chapter_ presentation 1221.5784
Quality review (1)_presentation of this 21
CEE 2 REPORT G7.pptxbdbshjdgsgjgsjfiuhsd
Database Infoormation System (DBIS).pptx
168300704-gasification-ppt.pdfhghhhsjsjhsuxush
Introduction to Basics of Ethical Hacking and Penetration Testing -Unit No. 1...
Computer network topology notes for revision
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
.pdf is not working space design for the following data for the following dat...
Acceptance and paychological effects of mandatory extra coach I classes.pptx
TRAFFIC-MANAGEMENT-AND-ACCIDENT-INVESTIGATION-WITH-DRIVING-PDF-FILE.pdf
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
05. PRACTICAL GUIDE TO MICROSOFT EXCEL.pptx
Data_Analytics_and_PowerBI_Presentation.pptx
advance b rammar.pptxfdgdfgdfsgdfgsdgfdfgdfgsdfgdfgdfg
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
“Getting Started with Data Analytics Using R – Concepts, Tools & Case Studies”
Chapter 3 METAL JOINING.pptnnnnnnnnnnnnn

R data types

  • 2. Beauty of R Data Types OBJECT
  • 3. R - objects In R programming language, • Variables are not declared as some data types • Variables are assigned with R – objects • The data type of R-object becomes the data type of the variable. NOTE: -> everything is just R - object
  • 4. Basic Data Types in R R Programming works with various data types, –Scalars –Vectors –Matrices –Factors –Data frames –Lists
  • 5. Basic Types • Numeric • Integers • Logical • Characters
  • 6. VECTORS • A vector is a one-dimensional array. • We can create a vector with all the basic data type we learnt before. • The simplest way to build a vector in R, is to use the ‘ c ‘ command. Ex: num_vec <- c(1, 2, 3, 4) chr_vec <- c(“a”, ”b”, ”c”)
  • 7. MATRIX • A matrix is a 2-dimensional array that has m number of rows and n number of columns. • In other words, matrix is a combination of two or more vectors with the same data type. NOTE: In R, more than two-dimensional arrays can also be created Semantic: matrix( data, nrow, ncol, byrow = TRUE/FALSE)
  • 8. FACTORS • Factor is a variable in R which take on a limited number of different values; such variables are often referred to as categorical variables. • In other words, R stores categorical variables into a factor. Semantic: factor(x = character(), levels, labels = levels, ordered = is.ordered(x) )
  • 9. Data frames • A data frame is a list of vectors which are of equal length. • A matrix contains only one type of data, while a data frame accepts different data types (numeric, character, factor, etc.). Semantic: data.frame( df, stringsAsFactors = TRUE)
  • 10. Lists • A list store many kinds of object in the order expected. • It can include matrices, vectors data frames or lists. • A list is similar; we can store a collection of objects and use them when we need them. Semantic: list( element_1, element_2, ... ) arguments: -element_1: store any type of R object -...: pass as many objects as specifying. Each object needs to be separated by a comma.