SlideShare a Scribd company logo
1 of 27
R Data Structures
WMG Training
Sept 2016
National Environmental Standards and Regulations Enforcement Agency
(NESREA)
Facilitator: Victor Ordu
Source: H Wickham (2014). Advanced R. Chapman & Hall, Boca Raton. http://adv-r.had.co.nz/
Recap
Recap
• Caveat
– Not everything I will tell you will be 100% correct
– Why?
• Stupid mistakes
• Updates
• New knowledge
• Multiple approaches, some better than others
• Continuous learning
– Moral: commit to personal growth
Notation
• Regular text with look like this…
• Highlighted items will look like this…
• this <- R_code(“will look like”)
Types of Data Structures
1. Vectors
2. Data frames
3. Matrices
4. Lists
5. Arrays
Types of Data Structures
1. Vectors
2. Data frames
3. Matrices
4. Lists
5. Arrays
Kinds of Vectors
• Six (6) kinds:
1. Character
2. Integer
3. Double (or numeric)
4. Logical
Vectors
• Common characteristics
– All elements are of a particular data type (in lay
language, “type” would be numbers, words, etc.)
– One-dimensional
– The lowest vector is of length 1
– The largest … well, depends on the .Machine
Making vectors
• By assignment
– The concatenate function
• Latin: con – caten – atus (chain)
• Some call it “combine” function
• Indispensible in creating vectors
• You can ‘grow’ a vector
– You may ask how, much, much, much, much later
• Character vectors
– Strings are always placed in quotation marks when
coding i.e. “boy”, “NESREA”, “R is easy to
learn”, “A string can be a whole
sentence!”, “9”.
– Some character vectors are inbuilt into R e.g.
letters, LETTERS, month.abb, month.name
– Remember use quotation marks: “ ” or ‘ ’.
– We can create empty vectors with specific lengths e.g.
character(length = 10) or character(10)
– Limit approx. 231 (about 2 billion)
characters!
– Exercise
• Start a clean slate with rm(list = ls())
• Make a character vector Name containing full names
(both Surname and Given Name) of 10 adults
• Make a second vector Facility of names of 10
facilities (imaginary, please!)
• Use typeof() to check what type of vector Name is
• Confirm the type of Facility using
is.character()
• Note: We can use as.character() to convert
another vector to a character vector.
• Integer vectors
– 1L, 2L, 3L
• Why the ‘L’?
– Not numerical per se
– Wide range – max up to 2,147,483,647
– Exercise
• Make an integer vector Age of 10 adult subjects
• Make an integer vector StaffStrength for 10 facilities
• Numeric (double) vectors
– These are real numbers
– Story of the term double
– Some numeric vectors are inbuilt – mathematical
constants e.g. pi, exp(1),
• Logical vectors
– TRUE/FALSE (not true/false); T/F
– Zero is FALSE; any non-zero is TRUE
– Exercise
• Make a logical vector PermitSighted for 10 facilities.
• Make another one usingPPE for 10 individuals.
• Use str(), typeof(), is.logical(), to explore them.
Stats brief
• Types of variables
– Quantitative
– Qualitative
• Levels of measurement
– Nominal
– Ordinal
– Interval
– Ratio
Factors
• Integer values that are mapped to “strings”
• Used to represent categorical data
• Each category is called a level
• One of the most powerful uses of R
– Exercise
• Make a vector industryType using 3 categories – small,
medium, large – for 10 facilities only.
• Make a factor industryCategory by calling the function
factor() on industryType.
• Now use typeof(), is.factor, is.character,
is.integer() to review these 2 objects.
Things to note…
• Legal names
• Coercion
• Limits
• Common mistakes
– Confusing factors with characters
Homogenous Heterogeneous
1-dimension Atomic vectors Lists
2-dimensions Matrices Data frames
N-dimensions Arrays
> R toolbox
› help() or ?
› getwd(); setwd()
› ls()
› rm()
› save(); load()
> R toolbox
• An example – ls()
– It’s relatively easy to see all the objects at a glance
– Note that this function is called without any
arguments
> R toolbox
• But how do you deal with this?
Long list beyond screen
> R toolbox
– Extend use of functions by defining other
parameters (optional)
– Use ? to learn about a function’s uses &
arguments
– When more familiar, use others like args()
> R toolbox
Types of Data Structures
1. Vectors
2. Data frames
3. Matrices
4. Lists
5. Arrays

More Related Content

What's hot

Introduction To Data Structures.
Introduction To Data Structures.Introduction To Data Structures.
Introduction To Data Structures.Education Front
 
Data Structure # vpmp polytechnic
Data Structure # vpmp polytechnicData Structure # vpmp polytechnic
Data Structure # vpmp polytechniclavparmar007
 
BCA DATA STRUCTURES INTRODUCTION AND OVERVIEW SOWMYA JYOTHI
BCA DATA STRUCTURES INTRODUCTION AND OVERVIEW SOWMYA JYOTHIBCA DATA STRUCTURES INTRODUCTION AND OVERVIEW SOWMYA JYOTHI
BCA DATA STRUCTURES INTRODUCTION AND OVERVIEW SOWMYA JYOTHISowmya Jyothi
 
Introduction to Data Structure part 1
Introduction to Data Structure part 1Introduction to Data Structure part 1
Introduction to Data Structure part 1ProfSonaliGholveDoif
 
Arrays declartion and initialization
Arrays declartion and initializationArrays declartion and initialization
Arrays declartion and initializationsangrampatil81
 
Files and data storage
Files and data storageFiles and data storage
Files and data storageZaid Shabbir
 
BCA DATA STRUCTURES SEARCHING AND SORTING MRS.SOWMYA JYOTHI
BCA DATA STRUCTURES SEARCHING AND SORTING MRS.SOWMYA JYOTHIBCA DATA STRUCTURES SEARCHING AND SORTING MRS.SOWMYA JYOTHI
BCA DATA STRUCTURES SEARCHING AND SORTING MRS.SOWMYA JYOTHISowmya Jyothi
 
Introduction of data structures and algorithms
Introduction of data structures and algorithmsIntroduction of data structures and algorithms
Introduction of data structures and algorithmsVinayKumarV16
 
DATA STRUCTURE
DATA STRUCTUREDATA STRUCTURE
DATA STRUCTURERohit Rai
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structureVivek Kumar Sinha
 
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 questionsProf. Dr. K. Adisesha
 
Data Structures - Lecture 2 [Introduction to Data Structures]
Data Structures - Lecture 2 [Introduction to Data Structures]Data Structures - Lecture 2 [Introduction to Data Structures]
Data Structures - Lecture 2 [Introduction to Data Structures]Muhammad Hammad Waseem
 
Data Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer ScienceData Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer ScienceTransweb Global Inc
 
How to handling strings in r
How to handling strings in rHow to handling strings in r
How to handling strings in rPramod Rathore
 
Lecture 1 data structures and algorithms
Lecture 1 data structures and algorithmsLecture 1 data structures and algorithms
Lecture 1 data structures and algorithmsAakash deep Singhal
 

What's hot (20)

Introduction To Data Structures.
Introduction To Data Structures.Introduction To Data Structures.
Introduction To Data Structures.
 
Data Structure # vpmp polytechnic
Data Structure # vpmp polytechnicData Structure # vpmp polytechnic
Data Structure # vpmp polytechnic
 
Pandas
PandasPandas
Pandas
 
BCA DATA STRUCTURES INTRODUCTION AND OVERVIEW SOWMYA JYOTHI
BCA DATA STRUCTURES INTRODUCTION AND OVERVIEW SOWMYA JYOTHIBCA DATA STRUCTURES INTRODUCTION AND OVERVIEW SOWMYA JYOTHI
BCA DATA STRUCTURES INTRODUCTION AND OVERVIEW SOWMYA JYOTHI
 
Introduction to Data Structure part 1
Introduction to Data Structure part 1Introduction to Data Structure part 1
Introduction to Data Structure part 1
 
Arrays in C
Arrays in CArrays in C
Arrays in C
 
Arrays declartion and initialization
Arrays declartion and initializationArrays declartion and initialization
Arrays declartion and initialization
 
Files and data storage
Files and data storageFiles and data storage
Files and data storage
 
BCA DATA STRUCTURES SEARCHING AND SORTING MRS.SOWMYA JYOTHI
BCA DATA STRUCTURES SEARCHING AND SORTING MRS.SOWMYA JYOTHIBCA DATA STRUCTURES SEARCHING AND SORTING MRS.SOWMYA JYOTHI
BCA DATA STRUCTURES SEARCHING AND SORTING MRS.SOWMYA JYOTHI
 
Introduction of data structures and algorithms
Introduction of data structures and algorithmsIntroduction of data structures and algorithms
Introduction of data structures and algorithms
 
DATA STRUCTURE
DATA STRUCTUREDATA STRUCTURE
DATA STRUCTURE
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structure
 
Types Of Data Structure
Types Of Data StructureTypes Of Data Structure
Types Of Data Structure
 
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
 
Data Structures - Lecture 2 [Introduction to Data Structures]
Data Structures - Lecture 2 [Introduction to Data Structures]Data Structures - Lecture 2 [Introduction to Data Structures]
Data Structures - Lecture 2 [Introduction to Data Structures]
 
Data Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer ScienceData Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer Science
 
Rdbms
RdbmsRdbms
Rdbms
 
How to handling strings in r
How to handling strings in rHow to handling strings in r
How to handling strings in r
 
Lecture 1 data structures and algorithms
Lecture 1 data structures and algorithmsLecture 1 data structures and algorithms
Lecture 1 data structures and algorithms
 
Data Structures
Data StructuresData Structures
Data Structures
 

Similar to R Data Structures (Part 1)

Introduction to R for Learning Analytics Researchers
Introduction to R for Learning Analytics ResearchersIntroduction to R for Learning Analytics Researchers
Introduction to R for Learning Analytics ResearchersVitomir Kovanovic
 
Big data analytics with R tool.pptx
Big data analytics with R tool.pptxBig data analytics with R tool.pptx
Big data analytics with R tool.pptxsalutiontechnology
 
Intro to data science module 1 r
Intro to data science module 1 rIntro to data science module 1 r
Intro to data science module 1 ramuletc
 
Advanced Data Analytics with R Programming.ppt
Advanced Data Analytics with R Programming.pptAdvanced Data Analytics with R Programming.ppt
Advanced Data Analytics with R Programming.pptAnshika865276
 
Basic data analysis using R.
Basic data analysis using R.Basic data analysis using R.
Basic data analysis using R.C. Tobin Magle
 
Unit I - 1R introduction to R program.pptx
Unit I - 1R introduction to R program.pptxUnit I - 1R introduction to R program.pptx
Unit I - 1R introduction to R program.pptxSreeLaya9
 
ProgFund_Lecture_3_Data_Structures_and_Iteration-1.pdf
ProgFund_Lecture_3_Data_Structures_and_Iteration-1.pdfProgFund_Lecture_3_Data_Structures_and_Iteration-1.pdf
ProgFund_Lecture_3_Data_Structures_and_Iteration-1.pdflailoesakhan
 
ProgPrinc_Lecture_3_Data_Structures_and_Iteration-2.pdf
ProgPrinc_Lecture_3_Data_Structures_and_Iteration-2.pdfProgPrinc_Lecture_3_Data_Structures_and_Iteration-2.pdf
ProgPrinc_Lecture_3_Data_Structures_and_Iteration-2.pdflailoesakhan
 
Introduction to basic statistics
Introduction to basic statisticsIntroduction to basic statistics
Introduction to basic statisticsIBM
 
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 ANALYTICSHaritikaChhatwal1
 
Introduction to R.pptx
Introduction to R.pptxIntroduction to R.pptx
Introduction to R.pptxAvinabaHandson
 
ch6-Short.ppt eee cse www rrr www qqq rrr ttt
ch6-Short.ppt eee cse www rrr www qqq rrr tttch6-Short.ppt eee cse www rrr www qqq rrr ttt
ch6-Short.ppt eee cse www rrr www qqq rrr tttwinimag331
 

Similar to R Data Structures (Part 1) (20)

Introduction to R for Learning Analytics Researchers
Introduction to R for Learning Analytics ResearchersIntroduction to R for Learning Analytics Researchers
Introduction to R for Learning Analytics Researchers
 
R tutorial
R tutorialR tutorial
R tutorial
 
R training2
R training2R training2
R training2
 
محاضرة برنامج التحليل الكمي R program د.هديل القفيدي
محاضرة برنامج التحليل الكمي   R program د.هديل القفيديمحاضرة برنامج التحليل الكمي   R program د.هديل القفيدي
محاضرة برنامج التحليل الكمي R program د.هديل القفيدي
 
Big data analytics with R tool.pptx
Big data analytics with R tool.pptxBig data analytics with R tool.pptx
Big data analytics with R tool.pptx
 
Intro to data science module 1 r
Intro to data science module 1 rIntro to data science module 1 r
Intro to data science module 1 r
 
محاضرة برنامج التحليل الكمي R program د.هديل القفيدي
محاضرة برنامج التحليل الكمي   R program د.هديل القفيديمحاضرة برنامج التحليل الكمي   R program د.هديل القفيدي
محاضرة برنامج التحليل الكمي R program د.هديل القفيدي
 
Advanced Data Analytics with R Programming.ppt
Advanced Data Analytics with R Programming.pptAdvanced Data Analytics with R Programming.ppt
Advanced Data Analytics with R Programming.ppt
 
Basic data analysis using R.
Basic data analysis using R.Basic data analysis using R.
Basic data analysis using R.
 
R programming by ganesh kavhar
R programming by ganesh kavharR programming by ganesh kavhar
R programming by ganesh kavhar
 
Unit I - 1R introduction to R program.pptx
Unit I - 1R introduction to R program.pptxUnit I - 1R introduction to R program.pptx
Unit I - 1R introduction to R program.pptx
 
ProgFund_Lecture_3_Data_Structures_and_Iteration-1.pdf
ProgFund_Lecture_3_Data_Structures_and_Iteration-1.pdfProgFund_Lecture_3_Data_Structures_and_Iteration-1.pdf
ProgFund_Lecture_3_Data_Structures_and_Iteration-1.pdf
 
ProgPrinc_Lecture_3_Data_Structures_and_Iteration-2.pdf
ProgPrinc_Lecture_3_Data_Structures_and_Iteration-2.pdfProgPrinc_Lecture_3_Data_Structures_and_Iteration-2.pdf
ProgPrinc_Lecture_3_Data_Structures_and_Iteration-2.pdf
 
Introduction to basic statistics
Introduction to basic statisticsIntroduction to basic statistics
Introduction to basic statistics
 
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.pptx
Introduction to R.pptxIntroduction to R.pptx
Introduction to R.pptx
 
R data types
R data typesR data types
R data types
 
Java session3
Java session3Java session3
Java session3
 
Introduction to R
Introduction to RIntroduction to R
Introduction to R
 
ch6-Short.ppt eee cse www rrr www qqq rrr ttt
ch6-Short.ppt eee cse www rrr www qqq rrr tttch6-Short.ppt eee cse www rrr www qqq rrr ttt
ch6-Short.ppt eee cse www rrr www qqq rrr ttt
 

Recently uploaded

EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxnada99848
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 

Recently uploaded (20)

EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptx
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 

R Data Structures (Part 1)

  • 1. R Data Structures WMG Training Sept 2016 National Environmental Standards and Regulations Enforcement Agency (NESREA) Facilitator: Victor Ordu
  • 2. Source: H Wickham (2014). Advanced R. Chapman & Hall, Boca Raton. http://adv-r.had.co.nz/
  • 5. • Caveat – Not everything I will tell you will be 100% correct – Why? • Stupid mistakes • Updates • New knowledge • Multiple approaches, some better than others • Continuous learning – Moral: commit to personal growth
  • 6. Notation • Regular text with look like this… • Highlighted items will look like this… • this <- R_code(“will look like”)
  • 7. Types of Data Structures 1. Vectors 2. Data frames 3. Matrices 4. Lists 5. Arrays
  • 8. Types of Data Structures 1. Vectors 2. Data frames 3. Matrices 4. Lists 5. Arrays
  • 9.
  • 10. Kinds of Vectors • Six (6) kinds: 1. Character 2. Integer 3. Double (or numeric) 4. Logical
  • 11. Vectors • Common characteristics – All elements are of a particular data type (in lay language, “type” would be numbers, words, etc.) – One-dimensional – The lowest vector is of length 1 – The largest … well, depends on the .Machine
  • 12. Making vectors • By assignment – The concatenate function • Latin: con – caten – atus (chain) • Some call it “combine” function • Indispensible in creating vectors • You can ‘grow’ a vector – You may ask how, much, much, much, much later
  • 13. • Character vectors – Strings are always placed in quotation marks when coding i.e. “boy”, “NESREA”, “R is easy to learn”, “A string can be a whole sentence!”, “9”. – Some character vectors are inbuilt into R e.g. letters, LETTERS, month.abb, month.name – Remember use quotation marks: “ ” or ‘ ’. – We can create empty vectors with specific lengths e.g. character(length = 10) or character(10) – Limit approx. 231 (about 2 billion) characters!
  • 14. – Exercise • Start a clean slate with rm(list = ls()) • Make a character vector Name containing full names (both Surname and Given Name) of 10 adults • Make a second vector Facility of names of 10 facilities (imaginary, please!) • Use typeof() to check what type of vector Name is • Confirm the type of Facility using is.character() • Note: We can use as.character() to convert another vector to a character vector.
  • 15. • Integer vectors – 1L, 2L, 3L • Why the ‘L’? – Not numerical per se – Wide range – max up to 2,147,483,647 – Exercise • Make an integer vector Age of 10 adult subjects • Make an integer vector StaffStrength for 10 facilities
  • 16. • Numeric (double) vectors – These are real numbers – Story of the term double – Some numeric vectors are inbuilt – mathematical constants e.g. pi, exp(1),
  • 17. • Logical vectors – TRUE/FALSE (not true/false); T/F – Zero is FALSE; any non-zero is TRUE – Exercise • Make a logical vector PermitSighted for 10 facilities. • Make another one usingPPE for 10 individuals. • Use str(), typeof(), is.logical(), to explore them.
  • 18. Stats brief • Types of variables – Quantitative – Qualitative • Levels of measurement – Nominal – Ordinal – Interval – Ratio
  • 19. Factors • Integer values that are mapped to “strings” • Used to represent categorical data • Each category is called a level • One of the most powerful uses of R – Exercise • Make a vector industryType using 3 categories – small, medium, large – for 10 facilities only. • Make a factor industryCategory by calling the function factor() on industryType. • Now use typeof(), is.factor, is.character, is.integer() to review these 2 objects.
  • 20. Things to note… • Legal names • Coercion • Limits • Common mistakes – Confusing factors with characters
  • 21. Homogenous Heterogeneous 1-dimension Atomic vectors Lists 2-dimensions Matrices Data frames N-dimensions Arrays
  • 22. > R toolbox › help() or ? › getwd(); setwd() › ls() › rm() › save(); load()
  • 23. > R toolbox • An example – ls() – It’s relatively easy to see all the objects at a glance – Note that this function is called without any arguments
  • 24. > R toolbox • But how do you deal with this? Long list beyond screen
  • 25. > R toolbox – Extend use of functions by defining other parameters (optional) – Use ? to learn about a function’s uses & arguments – When more familiar, use others like args()
  • 27. Types of Data Structures 1. Vectors 2. Data frames 3. Matrices 4. Lists 5. Arrays

Editor's Notes

  1. In the Bible (presumably KJV): 3,566,480 letters 31,102 verses 1,189 chapters