SlideShare a Scribd company logo
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

What's hot

Presentation on python data type
Presentation on python data typePresentation on python data type
Presentation on python data type
swati kushwaha
 
Array in C
Array in CArray in C
Array in C
Kamal Acharya
 
Exploratory Data Analysis
Exploratory Data AnalysisExploratory Data Analysis
Exploratory Data Analysis
Umair Shafique
 
R Basics
R BasicsR Basics
All data models in dbms
All data models in dbmsAll data models in dbms
All data models in dbmsNaresh Kumar
 
Data preprocessing
Data preprocessingData preprocessing
Data preprocessing
Gajanand Sharma
 
Data warehousing and online analytical processing
Data warehousing and online analytical processingData warehousing and online analytical processing
Data warehousing and online analytical processing
VijayasankariS
 
Python Exception Handling
Python Exception HandlingPython Exception Handling
Python Exception Handling
Megha V
 
R programming groundup-basic-section-i
R programming groundup-basic-section-iR programming groundup-basic-section-i
R programming groundup-basic-section-i
Dr. Awase Khirni Syed
 
Data preprocessing
Data preprocessingData preprocessing
Data preprocessing
Jason Rodrigues
 
Variables & Data Types in R
Variables & Data Types in RVariables & Data Types in R
Variables & Data Types in R
Rsquared Academy
 
Python Pandas
Python PandasPython Pandas
Python Pandas
Sunil OS
 
Variables in python
Variables in pythonVariables in python
Variables in python
Jaya Kumari
 
Data Visualization With R
Data Visualization With RData Visualization With R
Data Visualization With R
Rsquared Academy
 
R Programming: Introduction to Matrices
R Programming: Introduction to MatricesR Programming: Introduction to Matrices
R Programming: Introduction to Matrices
Rsquared Academy
 
Database Design
Database DesignDatabase Design
Database Designlearnt
 
R Programming: Introduction To R Packages
R Programming: Introduction To R PackagesR Programming: Introduction To R Packages
R Programming: Introduction To R Packages
Rsquared Academy
 
Lect8 Classification & prediction
Lect8 Classification & predictionLect8 Classification & prediction
Lect8 Classification & prediction
hktripathy
 

What's hot (20)

Presentation on python data type
Presentation on python data typePresentation on python data type
Presentation on python data type
 
Array in C
Array in CArray in C
Array in C
 
Exploratory Data Analysis
Exploratory Data AnalysisExploratory Data Analysis
Exploratory Data Analysis
 
R Basics
R BasicsR Basics
R Basics
 
All data models in dbms
All data models in dbmsAll data models in dbms
All data models in dbms
 
Data preprocessing
Data preprocessingData preprocessing
Data preprocessing
 
Oop concepts in python
Oop concepts in pythonOop concepts in python
Oop concepts in python
 
Data warehousing and online analytical processing
Data warehousing and online analytical processingData warehousing and online analytical processing
Data warehousing and online analytical processing
 
Python Exception Handling
Python Exception HandlingPython Exception Handling
Python Exception Handling
 
R programming groundup-basic-section-i
R programming groundup-basic-section-iR programming groundup-basic-section-i
R programming groundup-basic-section-i
 
Data preprocessing
Data preprocessingData preprocessing
Data preprocessing
 
Variables & Data Types in R
Variables & Data Types in RVariables & Data Types in R
Variables & Data Types in R
 
Python Pandas
Python PandasPython Pandas
Python Pandas
 
Variables in python
Variables in pythonVariables in python
Variables in python
 
Reading Data into R
Reading Data into RReading Data into R
Reading Data into R
 
Data Visualization With R
Data Visualization With RData Visualization With R
Data Visualization With R
 
R Programming: Introduction to Matrices
R Programming: Introduction to MatricesR Programming: Introduction to Matrices
R Programming: Introduction to Matrices
 
Database Design
Database DesignDatabase Design
Database Design
 
R Programming: Introduction To R Packages
R Programming: Introduction To R PackagesR Programming: Introduction To R Packages
R Programming: Introduction To R Packages
 
Lect8 Classification & prediction
Lect8 Classification & predictionLect8 Classification & prediction
Lect8 Classification & prediction
 

Similar to R data types

R training2
R training2R training2
R training2
Hellen Gakuruh
 
20130222 Data structures and manipulation in R
20130222 Data structures and manipulation in R20130222 Data structures and manipulation in R
20130222 Data structures and manipulation in RKazuki Yoshida
 
Introduction to R _IMPORTANT FOR DATA ANALYTICS
Introduction to R _IMPORTANT FOR DATA ANALYTICSIntroduction to R _IMPORTANT FOR DATA ANALYTICS
Introduction to R _IMPORTANT FOR DATA ANALYTICS
HaritikaChhatwal1
 
Introduction To R Language
Introduction To R LanguageIntroduction To R Language
Introduction To R Language
Gaurang Dobariya
 
Language R
Language RLanguage R
Language R
Girish Khanzode
 
2 data structure in R
2 data structure in R2 data structure in R
2 data structure in R
naroranisha
 
Introduction to R.pptx
Introduction to R.pptxIntroduction to R.pptx
Introduction to R.pptx
karthikks82
 
Introduction to R.pptx
Introduction to R.pptxIntroduction to R.pptx
Introduction to R.pptx
RohithK65
 
Loops and arrays
Loops and arraysLoops and arrays
Loops and arrays
abha aggarwal
 
java.pdf
java.pdfjava.pdf
java.pdf
RAJCHATTERJEE24
 
Numeric Data Types & Strings
Numeric Data Types & StringsNumeric Data Types & Strings
Numeric Data Types & Strings
Abhinav Porwal
 
Data Analytics with R and SQL Server
Data Analytics with R and SQL ServerData Analytics with R and SQL Server
Data Analytics with R and SQL Server
Stéphane Fréchette
 
R Data Structures (Part 1)
R Data Structures (Part 1)R Data Structures (Part 1)
R Data Structures (Part 1)
Victor Ordu
 
Pandas
PandasPandas
20130215 Reading data into R
20130215 Reading data into R20130215 Reading data into R
20130215 Reading data into RKazuki Yoshida
 
DataStructures.pptx
DataStructures.pptxDataStructures.pptx
DataStructures.pptx
Thanuj Pothula
 
Unit 2 linear data structures
Unit 2   linear data structuresUnit 2   linear data structures
Unit 2 linear data structures
Senthil Murugan
 
Numpy.pdf
Numpy.pdfNumpy.pdf
Numpy.pdf
Arvind Pathak
 

Similar to R data types (20)

R training2
R training2R training2
R training2
 
20130222 Data structures and manipulation in R
20130222 Data structures and manipulation in R20130222 Data structures and manipulation in R
20130222 Data structures and manipulation in R
 
Introduction to R _IMPORTANT FOR DATA ANALYTICS
Introduction to R _IMPORTANT FOR DATA ANALYTICSIntroduction to R _IMPORTANT FOR DATA ANALYTICS
Introduction to R _IMPORTANT FOR DATA ANALYTICS
 
Introduction To R Language
Introduction To R LanguageIntroduction To R Language
Introduction To R Language
 
Language R
Language RLanguage R
Language R
 
2 data structure in R
2 data structure in R2 data structure in R
2 data structure in R
 
Introduction to R.pptx
Introduction to R.pptxIntroduction to R.pptx
Introduction to R.pptx
 
R교육1
R교육1R교육1
R교육1
 
Introduction to R.pptx
Introduction to R.pptxIntroduction to R.pptx
Introduction to R.pptx
 
Loops and arrays
Loops and arraysLoops and arrays
Loops and arrays
 
java.pdf
java.pdfjava.pdf
java.pdf
 
Data types.pdf
Data types.pdfData types.pdf
Data types.pdf
 
Numeric Data Types & Strings
Numeric Data Types & StringsNumeric Data Types & Strings
Numeric Data Types & Strings
 
Data Analytics with R and SQL Server
Data Analytics with R and SQL ServerData Analytics with R and SQL Server
Data Analytics with R and SQL Server
 
R Data Structures (Part 1)
R Data Structures (Part 1)R Data Structures (Part 1)
R Data Structures (Part 1)
 
Pandas
PandasPandas
Pandas
 
20130215 Reading data into R
20130215 Reading data into R20130215 Reading data into R
20130215 Reading data into R
 
DataStructures.pptx
DataStructures.pptxDataStructures.pptx
DataStructures.pptx
 
Unit 2 linear data structures
Unit 2   linear data structuresUnit 2   linear data structures
Unit 2 linear data structures
 
Numpy.pdf
Numpy.pdfNumpy.pdf
Numpy.pdf
 

More from Teachers Mitraa

R installing
R installingR installing
R installing
Teachers Mitraa
 
R introduction
R introductionR introduction
R introduction
Teachers Mitraa
 
R joins on dataframes
R joins on dataframesR joins on dataframes
R joins on dataframes
Teachers Mitraa
 
R-script
R-scriptR-script
R-script
Teachers Mitraa
 
E library in the 21st century
E library in the 21st centuryE library in the 21st century
E library in the 21st century
Teachers Mitraa
 
Impact of Crises on economy
Impact of Crises on economyImpact of Crises on economy
Impact of Crises on economy
Teachers Mitraa
 
Mobile & Web based teaching and learning
Mobile & Web based teaching and learningMobile & Web based teaching and learning
Mobile & Web based teaching and learning
Teachers Mitraa
 
M learning post covid impact
M learning post covid impactM learning post covid impact
M learning post covid impact
Teachers Mitraa
 
Data analysis and interpretation
Data analysis and interpretationData analysis and interpretation
Data analysis and interpretation
Teachers Mitraa
 
Reseach Paper and Literature Review
Reseach Paper and Literature ReviewReseach Paper and Literature Review
Reseach Paper and Literature Review
Teachers Mitraa
 
Sales management
Sales managementSales management
Sales management
Teachers Mitraa
 
Trans shipment problem
Trans shipment problemTrans shipment problem
Trans shipment problem
Teachers Mitraa
 
Types of research mba mr
Types of research mba mrTypes of research mba mr
Types of research mba mr
Teachers Mitraa
 
Regression analysis
Regression analysisRegression analysis
Regression analysis
Teachers Mitraa
 
Law of contract
Law of contract  Law of contract
Law of contract
Teachers Mitraa
 

More from Teachers Mitraa (15)

R installing
R installingR installing
R installing
 
R introduction
R introductionR introduction
R introduction
 
R joins on dataframes
R joins on dataframesR joins on dataframes
R joins on dataframes
 
R-script
R-scriptR-script
R-script
 
E library in the 21st century
E library in the 21st centuryE library in the 21st century
E library in the 21st century
 
Impact of Crises on economy
Impact of Crises on economyImpact of Crises on economy
Impact of Crises on economy
 
Mobile & Web based teaching and learning
Mobile & Web based teaching and learningMobile & Web based teaching and learning
Mobile & Web based teaching and learning
 
M learning post covid impact
M learning post covid impactM learning post covid impact
M learning post covid impact
 
Data analysis and interpretation
Data analysis and interpretationData analysis and interpretation
Data analysis and interpretation
 
Reseach Paper and Literature Review
Reseach Paper and Literature ReviewReseach Paper and Literature Review
Reseach Paper and Literature Review
 
Sales management
Sales managementSales management
Sales management
 
Trans shipment problem
Trans shipment problemTrans shipment problem
Trans shipment problem
 
Types of research mba mr
Types of research mba mrTypes of research mba mr
Types of research mba mr
 
Regression analysis
Regression analysisRegression analysis
Regression analysis
 
Law of contract
Law of contract  Law of contract
Law of contract
 

Recently uploaded

一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
oz8q3jxlp
 
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
nscud
 
standardisation of garbhpala offhgfffghh
standardisation of garbhpala offhgfffghhstandardisation of garbhpala offhgfffghh
standardisation of garbhpala offhgfffghh
ArpitMalhotra16
 
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
John Andrews
 
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
slg6lamcq
 
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
NABLAS株式会社
 
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
ahzuo
 
一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单
ewymefz
 
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
ewymefz
 
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdfSample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Linda486226
 
Adjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTESAdjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTES
Subhajit Sahu
 
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
yhkoc
 
一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单
ocavb
 
Machine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptxMachine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptx
balafet
 
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
u86oixdj
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
ewymefz
 
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project PresentationPredicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Boston Institute of Analytics
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP
 
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
Tiktokethiodaily
 

Recently uploaded (20)

一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
 
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
 
standardisation of garbhpala offhgfffghh
standardisation of garbhpala offhgfffghhstandardisation of garbhpala offhgfffghh
standardisation of garbhpala offhgfffghh
 
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
 
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
 
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
 
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
 
一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单
 
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
 
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdfSample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
 
Adjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTESAdjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTES
 
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
 
一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单
 
Machine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptxMachine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptx
 
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
 
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project PresentationPredicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
 
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
 

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.