際際滷

際際滷Share a Scribd company logo
R
MULTI MODE
DATA STRUCTURES
kensights@outlook.com
LISTS
 Multi-mode data structures are required to manipulate data containing different types of
data elements e.g. CSVs, RDBMS tables, Excel sheets etc.
 Definition
 Container for any type of R objects
 Creation
 Using list function
 Naming elements is optional
 Original objects are copied
 Can be avoided by creating objects on fly
 Referencing elements
 Using name
 [[]]
 []
LISTS
 Attributes
 Length
 Names
 Mode
LISTS
 Subscripting or Referencing
 Blanks
 Positive / Negative
 Logical
 Character
 Difference between [[]] and []
 LIST$ELEMENT is same as LIST[[ELEMENT_IDX]]
 Adding new elements to list via $ or [[x]]
 Combining lists
LISTS
 Paradigms (how to use R lists)
 List-apply (lapply) maps a function over a vector returning each return value as an element of an
unnamed list
 Simple-apply (sapply) maps a function over a vector returning each return value as an element of a
vector
 Most functions return output in form of named list
DATA FRAME
 Definition
 Named list that can hold only vectors of same length
 Creation
 Using data.frame function passing vectors
 Attributes
 Mode
 Length
 Names
 Adding new columns to a data frame
DATA FRAME
 Subscripting or Referencing
 DATAFRAME$VECTOR
 All vector subscripting paradigms apply
 Referencing as a matrix
 Specification
 Blank [] : all elements
 Positive integers: keep those elements
 Negative integers: drop those elements return rest
 Logical: keep only those which are TRUE in position
 Character: keep whose names are specified
 Without the , DATAFRAME[spec]
 Return all rows but specified columns
 Preserving the dimensions (drop = F)
DATA FRAME
 Subscripting or Referencing
 DATAFRAME$VECTOR
 All vector subscripting paradigms apply
 Referencing as a matrix
 Specification
 Blank [] : all elements
 Positive integers: keep those elements
 Negative integers: drop those elements return rest
 Logical: keep only those which are TRUE in position
 Character: keep whose names are specified
 Without the , DATAFRAME[spec]
 Return all rows but specified columns
END NOTES
 Matrices and arrays are essentially vectors with dimensions
 Thus they can be morphed into one another

More Related Content

What's hot (20)

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
Sowmya Jyothi
Aaa ped-5-Data manipulation: Pandas
Aaa ped-5-Data manipulation: Pandas Aaa ped-5-Data manipulation: Pandas
Aaa ped-5-Data manipulation: Pandas
AminaRepo
Lecture 3 data structures and algorithms
Lecture 3 data structures and algorithmsLecture 3 data structures and algorithms
Lecture 3 data structures and algorithms
Aakash deep Singhal
C# Non generics collection
C# Non generics collectionC# Non generics collection
C# Non generics collection
Prem Kumar Badri
Presentation of array
Presentation of arrayPresentation of array
Presentation of array
Shamim Hossain
Elementary data structure
Elementary data structureElementary data structure
Elementary data structure
Biswajit Mandal
Knolx Session: Introducing Extractors in Scala
Knolx Session: Introducing Extractors in ScalaKnolx Session: Introducing Extractors in Scala
Knolx Session: Introducing Extractors in Scala
Ayush Mishra
Introduction to array and string
Introduction to array and stringIntroduction to array and string
Introduction to array and string
MuntasirMuhit
Data structure and its types
Data structure and its typesData structure and its types
Data structure and its types
Navtar Sidhu Brar
Arrays
ArraysArrays
Arrays
Manthan Dhavne
arrays
arraysarrays
arrays
Enakshi Chanda
Arrays
ArraysArrays
Arrays
sana younas
Introducing Pattern Matching in Scala
 Introducing Pattern Matching  in Scala Introducing Pattern Matching  in Scala
Introducing Pattern Matching in Scala
Ayush Mishra
Data handling in python
Data handling in pythonData handling in python
Data handling in python
deepalishinkar1
CSPC/ PPS Sorting methods
CSPC/ PPS Sorting methodsCSPC/ PPS Sorting methods
CSPC/ PPS Sorting methods
Ankur Srivastava
Data structures using c
Data structures using cData structures using c
Data structures using c
Prof. Dr. K. Adisesha
Knolx Session : Built-In Control Structures in Scala
Knolx Session : Built-In Control Structures in ScalaKnolx Session : Built-In Control Structures in Scala
Knolx Session : Built-In Control Structures in Scala
Ayush Mishra
One Dimentional Array
One Dimentional ArrayOne Dimentional Array
One Dimentional Array
Sonya Akter Rupa
Arrays
ArraysArrays
Arrays
Abdullahprince787
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structure
Vivek Kumar Sinha
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
Sowmya Jyothi
Aaa ped-5-Data manipulation: Pandas
Aaa ped-5-Data manipulation: Pandas Aaa ped-5-Data manipulation: Pandas
Aaa ped-5-Data manipulation: Pandas
AminaRepo
Lecture 3 data structures and algorithms
Lecture 3 data structures and algorithmsLecture 3 data structures and algorithms
Lecture 3 data structures and algorithms
Aakash deep Singhal
C# Non generics collection
C# Non generics collectionC# Non generics collection
C# Non generics collection
Prem Kumar Badri
Presentation of array
Presentation of arrayPresentation of array
Presentation of array
Shamim Hossain
Elementary data structure
Elementary data structureElementary data structure
Elementary data structure
Biswajit Mandal
Knolx Session: Introducing Extractors in Scala
Knolx Session: Introducing Extractors in ScalaKnolx Session: Introducing Extractors in Scala
Knolx Session: Introducing Extractors in Scala
Ayush Mishra
Introduction to array and string
Introduction to array and stringIntroduction to array and string
Introduction to array and string
MuntasirMuhit
Data structure and its types
Data structure and its typesData structure and its types
Data structure and its types
Navtar Sidhu Brar
Introducing Pattern Matching in Scala
 Introducing Pattern Matching  in Scala Introducing Pattern Matching  in Scala
Introducing Pattern Matching in Scala
Ayush Mishra
Data handling in python
Data handling in pythonData handling in python
Data handling in python
deepalishinkar1
CSPC/ PPS Sorting methods
CSPC/ PPS Sorting methodsCSPC/ PPS Sorting methods
CSPC/ PPS Sorting methods
Ankur Srivastava
Knolx Session : Built-In Control Structures in Scala
Knolx Session : Built-In Control Structures in ScalaKnolx Session : Built-In Control Structures in Scala
Knolx Session : Built-In Control Structures in Scala
Ayush Mishra
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structure
Vivek Kumar Sinha

Similar to R DATA STRUCTURES 2 (20)

DataStructures.pptx
DataStructures.pptxDataStructures.pptx
DataStructures.pptx
Thanuj Pothula
Moving Data to and From R
Moving Data to and From RMoving Data to and From R
Moving Data to and From R
Syracuse University
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
Session 1 - Databases-JUNE 2023.pdf
Session 1 - Databases-JUNE 2023.pdfSession 1 - Databases-JUNE 2023.pdf
Session 1 - Databases-JUNE 2023.pdf
SwapnilSaurav7
Javascript arrays
Javascript arraysJavascript arrays
Javascript arrays
Hassan Dar
Pandas csv
Pandas csvPandas csv
Pandas csv
Devashish Kumar
2 sql - single-row functions
2   sql - single-row functions2   sql - single-row functions
2 sql - single-row functions
Ankit Dubey
Complete SQL Tutorial In Hindi By Rishabh Mishra (Basic to Advance).pdf
Complete SQL Tutorial In Hindi By Rishabh Mishra (Basic to Advance).pdfComplete SQL Tutorial In Hindi By Rishabh Mishra (Basic to Advance).pdf
Complete SQL Tutorial In Hindi By Rishabh Mishra (Basic to Advance).pdf
PreetiKushwah6
Working with arrays in php
Working with arrays in phpWorking with arrays in php
Working with arrays in php
Kamal Acharya
Sql server 2016: System Databases, data types, DML, json, and built-in functions
Sql server 2016: System Databases, data types, DML, json, and built-in functionsSql server 2016: System Databases, data types, DML, json, and built-in functions
Sql server 2016: System Databases, data types, DML, json, and built-in functions
Seyed Ibrahim
lecture_3.ppt
lecture_3.pptlecture_3.ppt
lecture_3.ppt
Farhan646135
Ms sql-server
Ms sql-serverMs sql-server
Ms sql-server
Md.Mojibul Hoque
SQL.ppt
SQL.pptSQL.ppt
SQL.ppt
RickyLidar
4 SQL DML.pptx ASHEN WANNIARACHCHI USESS
4 SQL DML.pptx ASHEN WANNIARACHCHI USESS4 SQL DML.pptx ASHEN WANNIARACHCHI USESS
4 SQL DML.pptx ASHEN WANNIARACHCHI USESS
nimsarabuwaa2002
Data Base Management System.pdf
Data Base Management System.pdfData Base Management System.pdf
Data Base Management System.pdf
TENZING LHADON
Introduction To R Language
Introduction To R LanguageIntroduction To R Language
Introduction To R Language
Gaurang Dobariya
15925 structured query
15925 structured query15925 structured query
15925 structured query
Universitas Bina Darma Palembang
Lec 1 = introduction to structured query language (sql)
Lec 1 = introduction to structured query language (sql)Lec 1 = introduction to structured query language (sql)
Lec 1 = introduction to structured query language (sql)
Faisal Anwar
MS SQL Server
MS SQL ServerMS SQL Server
MS SQL Server
Md. Mahedee Hasan
java.pdf
java.pdfjava.pdf
java.pdf
RAJCHATTERJEE24
DataStructures.pptx
DataStructures.pptxDataStructures.pptx
DataStructures.pptx
Thanuj Pothula
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
Session 1 - Databases-JUNE 2023.pdf
Session 1 - Databases-JUNE 2023.pdfSession 1 - Databases-JUNE 2023.pdf
Session 1 - Databases-JUNE 2023.pdf
SwapnilSaurav7
Javascript arrays
Javascript arraysJavascript arrays
Javascript arrays
Hassan Dar
2 sql - single-row functions
2   sql - single-row functions2   sql - single-row functions
2 sql - single-row functions
Ankit Dubey
Complete SQL Tutorial In Hindi By Rishabh Mishra (Basic to Advance).pdf
Complete SQL Tutorial In Hindi By Rishabh Mishra (Basic to Advance).pdfComplete SQL Tutorial In Hindi By Rishabh Mishra (Basic to Advance).pdf
Complete SQL Tutorial In Hindi By Rishabh Mishra (Basic to Advance).pdf
PreetiKushwah6
Working with arrays in php
Working with arrays in phpWorking with arrays in php
Working with arrays in php
Kamal Acharya
Sql server 2016: System Databases, data types, DML, json, and built-in functions
Sql server 2016: System Databases, data types, DML, json, and built-in functionsSql server 2016: System Databases, data types, DML, json, and built-in functions
Sql server 2016: System Databases, data types, DML, json, and built-in functions
Seyed Ibrahim
4 SQL DML.pptx ASHEN WANNIARACHCHI USESS
4 SQL DML.pptx ASHEN WANNIARACHCHI USESS4 SQL DML.pptx ASHEN WANNIARACHCHI USESS
4 SQL DML.pptx ASHEN WANNIARACHCHI USESS
nimsarabuwaa2002
Data Base Management System.pdf
Data Base Management System.pdfData Base Management System.pdf
Data Base Management System.pdf
TENZING LHADON
Introduction To R Language
Introduction To R LanguageIntroduction To R Language
Introduction To R Language
Gaurang Dobariya
Lec 1 = introduction to structured query language (sql)
Lec 1 = introduction to structured query language (sql)Lec 1 = introduction to structured query language (sql)
Lec 1 = introduction to structured query language (sql)
Faisal Anwar

Recently uploaded (20)

chap2_nnejjejehhehehhhhhhhhhehslides.ppt
chap2_nnejjejehhehehhhhhhhhhehslides.pptchap2_nnejjejehhehehhhhhhhhhehslides.ppt
chap2_nnejjejehhehehhhhhhhhhehslides.ppt
Nikhil620181
deloitte esg 16092024 for september 2024 pdf.pdf
deloitte esg 16092024 for september 2024 pdf.pdfdeloitte esg 16092024 for september 2024 pdf.pdf
deloitte esg 16092024 for september 2024 pdf.pdf
JatinSharma979989
Threat Intelligence Platform_ The Future of Cybersecurity Defense.docx
Threat Intelligence Platform_ The Future of Cybersecurity Defense.docxThreat Intelligence Platform_ The Future of Cybersecurity Defense.docx
Threat Intelligence Platform_ The Future of Cybersecurity Defense.docx
dexposewebcast
20-NoSQLMongoDbiig data analytics hB.pdf
20-NoSQLMongoDbiig data analytics hB.pdf20-NoSQLMongoDbiig data analytics hB.pdf
20-NoSQLMongoDbiig data analytics hB.pdf
ssuser2d043c
AI-vs-Data-Science-Unraveling-the-Tech-Landscape
AI-vs-Data-Science-Unraveling-the-Tech-LandscapeAI-vs-Data-Science-Unraveling-the-Tech-Landscape
AI-vs-Data-Science-Unraveling-the-Tech-Landscape
Ozias Rondon
Hadoop-and-R-Programming-Powering-Big-Data-Analytics.pptx
Hadoop-and-R-Programming-Powering-Big-Data-Analytics.pptxHadoop-and-R-Programming-Powering-Big-Data-Analytics.pptx
Hadoop-and-R-Programming-Powering-Big-Data-Analytics.pptx
MdTahammulNoor
Introduction to Microsoft Power BI is a business analytics service
Introduction to Microsoft Power BI is a business analytics serviceIntroduction to Microsoft Power BI is a business analytics service
Introduction to Microsoft Power BI is a business analytics service
Kongu Engineering College, Perundurai, Erode
PPTjhjhghhhghghghggvgfggffgftftftftftft.ppt
PPTjhjhghhhghghghggvgfggffgftftftftftft.pptPPTjhjhghhhghghghggvgfggffgftftftftftft.ppt
PPTjhjhghhhghghghggvgfggffgftftftftftft.ppt
vmanjusundertamil21
A Simple Introduction to data Science- what is it and what does it do
A Simple Introduction to data Science- what is it and what does it doA Simple Introduction to data Science- what is it and what does it do
A Simple Introduction to data Science- what is it and what does it do
sarah mabrouk
TCP/IP PRESENTATION BY SHARMILA FALLER FOR INFORMATION SYSTEM
TCP/IP PRESENTATION BY SHARMILA FALLER FOR INFORMATION SYSTEMTCP/IP PRESENTATION BY SHARMILA FALLER FOR INFORMATION SYSTEM
TCP/IP PRESENTATION BY SHARMILA FALLER FOR INFORMATION SYSTEM
sharmilafaller
The rise of AI Agents - Beyond Automation_ The Rise of AI Agents in Service ...
The rise of AI Agents -  Beyond Automation_ The Rise of AI Agents in Service ...The rise of AI Agents -  Beyond Automation_ The Rise of AI Agents in Service ...
The rise of AI Agents - Beyond Automation_ The Rise of AI Agents in Service ...
Yasen Lilov
diagram ANN of factor and responses.pptx
diagram ANN of factor and responses.pptxdiagram ANN of factor and responses.pptx
diagram ANN of factor and responses.pptx
EdunjobiTunde1
GE-108-LESSON8.pptxbshsnsnsnsnsnsnnsnsnsnsnsbd
GE-108-LESSON8.pptxbshsnsnsnsnsnsnnsnsnsnsnsbdGE-108-LESSON8.pptxbshsnsnsnsnsnsnnsnsnsnsnsbd
GE-108-LESSON8.pptxbshsnsnsnsnsnsnnsnsnsnsnsbd
HarleySamboFavor
Advice vs Criticism which one is good and not.pptx
Advice vs Criticism which one is good and not.pptxAdvice vs Criticism which one is good and not.pptx
Advice vs Criticism which one is good and not.pptx
thecorneredtigers
Statistics for Management - standard deviation.pptx
Statistics for Management - standard deviation.pptxStatistics for Management - standard deviation.pptx
Statistics for Management - standard deviation.pptx
Jeya Sree
BoSEU25 | Diego de J坦dar | Why User Activation is the Key to Sustainable Growth
BoSEU25 | Diego de J坦dar | Why User Activation is the Key to Sustainable GrowthBoSEU25 | Diego de J坦dar | Why User Activation is the Key to Sustainable Growth
BoSEU25 | Diego de J坦dar | Why User Activation is the Key to Sustainable Growth
Business of Software Conference
Turinton Insights - Enterprise Agentic AI Platform
Turinton Insights - Enterprise Agentic AI PlatformTurinton Insights - Enterprise Agentic AI Platform
Turinton Insights - Enterprise Agentic AI Platform
vikrant530668
This presentation detail concepts of cryptocurrency
This presentation detail concepts of cryptocurrencyThis presentation detail concepts of cryptocurrency
This presentation detail concepts of cryptocurrency
Aslbtr
FOOD LAWS.pptxbshdhdhdhdhdhhdhdhdhdhdhhdh
FOOD LAWS.pptxbshdhdhdhdhdhhdhdhdhdhdhhdhFOOD LAWS.pptxbshdhdhdhdhdhhdhdhdhdhdhhdh
FOOD LAWS.pptxbshdhdhdhdhdhhdhdhdhdhdhhdh
cshdhdhvfsbzdb
100 questions on Data Science to Master interview
100 questions on Data Science to Master interview100 questions on Data Science to Master interview
100 questions on Data Science to Master interview
yashikanigam1
chap2_nnejjejehhehehhhhhhhhhehslides.ppt
chap2_nnejjejehhehehhhhhhhhhehslides.pptchap2_nnejjejehhehehhhhhhhhhehslides.ppt
chap2_nnejjejehhehehhhhhhhhhehslides.ppt
Nikhil620181
deloitte esg 16092024 for september 2024 pdf.pdf
deloitte esg 16092024 for september 2024 pdf.pdfdeloitte esg 16092024 for september 2024 pdf.pdf
deloitte esg 16092024 for september 2024 pdf.pdf
JatinSharma979989
Threat Intelligence Platform_ The Future of Cybersecurity Defense.docx
Threat Intelligence Platform_ The Future of Cybersecurity Defense.docxThreat Intelligence Platform_ The Future of Cybersecurity Defense.docx
Threat Intelligence Platform_ The Future of Cybersecurity Defense.docx
dexposewebcast
20-NoSQLMongoDbiig data analytics hB.pdf
20-NoSQLMongoDbiig data analytics hB.pdf20-NoSQLMongoDbiig data analytics hB.pdf
20-NoSQLMongoDbiig data analytics hB.pdf
ssuser2d043c
AI-vs-Data-Science-Unraveling-the-Tech-Landscape
AI-vs-Data-Science-Unraveling-the-Tech-LandscapeAI-vs-Data-Science-Unraveling-the-Tech-Landscape
AI-vs-Data-Science-Unraveling-the-Tech-Landscape
Ozias Rondon
Hadoop-and-R-Programming-Powering-Big-Data-Analytics.pptx
Hadoop-and-R-Programming-Powering-Big-Data-Analytics.pptxHadoop-and-R-Programming-Powering-Big-Data-Analytics.pptx
Hadoop-and-R-Programming-Powering-Big-Data-Analytics.pptx
MdTahammulNoor
PPTjhjhghhhghghghggvgfggffgftftftftftft.ppt
PPTjhjhghhhghghghggvgfggffgftftftftftft.pptPPTjhjhghhhghghghggvgfggffgftftftftftft.ppt
PPTjhjhghhhghghghggvgfggffgftftftftftft.ppt
vmanjusundertamil21
A Simple Introduction to data Science- what is it and what does it do
A Simple Introduction to data Science- what is it and what does it doA Simple Introduction to data Science- what is it and what does it do
A Simple Introduction to data Science- what is it and what does it do
sarah mabrouk
TCP/IP PRESENTATION BY SHARMILA FALLER FOR INFORMATION SYSTEM
TCP/IP PRESENTATION BY SHARMILA FALLER FOR INFORMATION SYSTEMTCP/IP PRESENTATION BY SHARMILA FALLER FOR INFORMATION SYSTEM
TCP/IP PRESENTATION BY SHARMILA FALLER FOR INFORMATION SYSTEM
sharmilafaller
The rise of AI Agents - Beyond Automation_ The Rise of AI Agents in Service ...
The rise of AI Agents -  Beyond Automation_ The Rise of AI Agents in Service ...The rise of AI Agents -  Beyond Automation_ The Rise of AI Agents in Service ...
The rise of AI Agents - Beyond Automation_ The Rise of AI Agents in Service ...
Yasen Lilov
diagram ANN of factor and responses.pptx
diagram ANN of factor and responses.pptxdiagram ANN of factor and responses.pptx
diagram ANN of factor and responses.pptx
EdunjobiTunde1
GE-108-LESSON8.pptxbshsnsnsnsnsnsnnsnsnsnsnsbd
GE-108-LESSON8.pptxbshsnsnsnsnsnsnnsnsnsnsnsbdGE-108-LESSON8.pptxbshsnsnsnsnsnsnnsnsnsnsnsbd
GE-108-LESSON8.pptxbshsnsnsnsnsnsnnsnsnsnsnsbd
HarleySamboFavor
Advice vs Criticism which one is good and not.pptx
Advice vs Criticism which one is good and not.pptxAdvice vs Criticism which one is good and not.pptx
Advice vs Criticism which one is good and not.pptx
thecorneredtigers
Statistics for Management - standard deviation.pptx
Statistics for Management - standard deviation.pptxStatistics for Management - standard deviation.pptx
Statistics for Management - standard deviation.pptx
Jeya Sree
BoSEU25 | Diego de J坦dar | Why User Activation is the Key to Sustainable Growth
BoSEU25 | Diego de J坦dar | Why User Activation is the Key to Sustainable GrowthBoSEU25 | Diego de J坦dar | Why User Activation is the Key to Sustainable Growth
BoSEU25 | Diego de J坦dar | Why User Activation is the Key to Sustainable Growth
Business of Software Conference
Turinton Insights - Enterprise Agentic AI Platform
Turinton Insights - Enterprise Agentic AI PlatformTurinton Insights - Enterprise Agentic AI Platform
Turinton Insights - Enterprise Agentic AI Platform
vikrant530668
This presentation detail concepts of cryptocurrency
This presentation detail concepts of cryptocurrencyThis presentation detail concepts of cryptocurrency
This presentation detail concepts of cryptocurrency
Aslbtr
FOOD LAWS.pptxbshdhdhdhdhdhhdhdhdhdhdhhdh
FOOD LAWS.pptxbshdhdhdhdhdhhdhdhdhdhdhhdhFOOD LAWS.pptxbshdhdhdhdhdhhdhdhdhdhdhhdh
FOOD LAWS.pptxbshdhdhdhdhdhhdhdhdhdhdhhdh
cshdhdhvfsbzdb
100 questions on Data Science to Master interview
100 questions on Data Science to Master interview100 questions on Data Science to Master interview
100 questions on Data Science to Master interview
yashikanigam1

R DATA STRUCTURES 2

  • 2. LISTS Multi-mode data structures are required to manipulate data containing different types of data elements e.g. CSVs, RDBMS tables, Excel sheets etc. Definition Container for any type of R objects Creation Using list function Naming elements is optional Original objects are copied Can be avoided by creating objects on fly Referencing elements Using name [[]] []
  • 4. LISTS Subscripting or Referencing Blanks Positive / Negative Logical Character Difference between [[]] and [] LIST$ELEMENT is same as LIST[[ELEMENT_IDX]] Adding new elements to list via $ or [[x]] Combining lists
  • 5. LISTS Paradigms (how to use R lists) List-apply (lapply) maps a function over a vector returning each return value as an element of an unnamed list Simple-apply (sapply) maps a function over a vector returning each return value as an element of a vector Most functions return output in form of named list
  • 6. DATA FRAME Definition Named list that can hold only vectors of same length Creation Using data.frame function passing vectors Attributes Mode Length Names Adding new columns to a data frame
  • 7. DATA FRAME Subscripting or Referencing DATAFRAME$VECTOR All vector subscripting paradigms apply Referencing as a matrix Specification Blank [] : all elements Positive integers: keep those elements Negative integers: drop those elements return rest Logical: keep only those which are TRUE in position Character: keep whose names are specified Without the , DATAFRAME[spec] Return all rows but specified columns Preserving the dimensions (drop = F)
  • 8. DATA FRAME Subscripting or Referencing DATAFRAME$VECTOR All vector subscripting paradigms apply Referencing as a matrix Specification Blank [] : all elements Positive integers: keep those elements Negative integers: drop those elements return rest Logical: keep only those which are TRUE in position Character: keep whose names are specified Without the , DATAFRAME[spec] Return all rows but specified columns
  • 9. END NOTES Matrices and arrays are essentially vectors with dimensions Thus they can be morphed into one another

Editor's Notes

  • #3: For effectively using R for gaining insights from data one needs to have working knowledge of the standard data types and data structures in R.
  • #4: For effectively using R for gaining insights from data one needs to have working knowledge of the standard data types and data structures in R.
  • #5: For effectively using R for gaining insights from data one needs to have working knowledge of the standard data types and data structures in R.
  • #6: For effectively using R for gaining insights from data one needs to have working knowledge of the standard data types and data structures in R.
  • #7: For effectively using R for gaining insights from data one needs to have working knowledge of the standard data types and data structures in R.
  • #8: For effectively using R for gaining insights from data one needs to have working knowledge of the standard data types and data structures in R.
  • #9: For effectively using R for gaining insights from data one needs to have working knowledge of the standard data types and data structures in R.
  • #10: For effectively using R for gaining insights from data one needs to have working knowledge of the standard data types and data structures in R.