SlideShare a Scribd company logo
Joins on Data frames
( Combining Data sets )
SachinSL
sachinsl06@gmail.com
Joining / Combining Data Sets
• Generally, join is the mechanism which connects
many data sets which are inter related.
• Whenever the data needed are distributed over in
many sources, the integration is done by
considering proper key variables.
• By joining two or more data sets in single object
can help us in overall understanding data sets.
• In R, we have numerous packages to combine the
two or more data sets.
WHAT WE VISUALIZE ?
• In this section, we shall see the join operation
on data frames which it most used data type.
• There are many type of joins & shall use the
dplyr package to simulate which are almost
similar to SQL methods.
• The dplyr package is widely used package for
data manipulation in R programming
Types of Joins
• left_join() ( Left Join )
• right_join() ( Right Join )
• inner_join() ( Inner Join )
• full_join() ( Full/Outer Join )
Example
Table_1 Table_2
Student Physics Student Maths
A 85 A 76
B 80 B 84
C 67 C 62
D 74 D 76
E 92 G 88
F 78 H 70
LEFT JOIN
Table_1 Table_2
Student Physics Student Maths
A 85 A 76
B 80 B 84
C 67 C 62
D 74 D 76
E 92 G 88
F 78 H 70
Student Physics Maths
A 85 76
B 80 84
C 67 62
D 74 76
E 92 NA
F 78 NA
RIGHT JOIN
Table_1 Table_2
Student Physics Student Maths
A 85 A 76
B 80 B 84
C 67 C 62
D 74 D 76
E 92 G 88
F 78 H 70
Student Physics Maths
A 85 76
B 80 84
C 67 62
D 74 76
G NA 88
H NA 70
INNER JOIN
Table_1 Table_2
Student Physics Student Maths
A 85 A 76
B 80 B 84
C 67 C 62
D 74 D 76
E 92 G 88
F 78 H 70
Student Physics Maths
A 85 76
B 80 84
C 67 62
D 74 76
FULL JOIN
Table_1 Table_2
Student Physics Student Maths
A 85 A 76
B 80 B 84
C 67 C 62
D 74 D 76
E 92 G 88
F 78 H 70
Student Physics Maths
A 85 76
B 80 84
C 67 62
D 74 76
E 92 NA
F 78 NA
G NA 88
H NA 70

More Related Content

PPTX
Number System & Set Theory
PPT
PPTX
R installing
PPTX
R introduction
PPTX
R-script
PPTX
R data types
PPTX
E library in the 21st century
PPTX
Impact of Crises on economy
Number System & Set Theory
R installing
R introduction
R-script
R data types
E library in the 21st century
Impact of Crises on economy

More from Teachers Mitraa (9)

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
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
Ad

Recently uploaded (20)

PPTX
Introduction-to-Cloud-ComputingFinal.pptx
PPTX
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
PDF
Fluorescence-microscope_Botany_detailed content
PPTX
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
PPTX
Computer network topology notes for revision
PPTX
climate analysis of Dhaka ,Banglades.pptx
PPTX
iec ppt-1 pptx icmr ppt on rehabilitation.pptx
PDF
Clinical guidelines as a resource for EBP(1).pdf
PPTX
mbdjdhjjodule 5-1 rhfhhfjtjjhafbrhfnfbbfnb
PPT
Quality review (1)_presentation of this 21
PDF
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
PPTX
oil_refinery_comprehensive_20250804084928 (1).pptx
PPTX
Business Ppt On Nestle.pptx huunnnhhgfvu
PPTX
ALIMENTARY AND BILIARY CONDITIONS 3-1.pptx
PPTX
Business Acumen Training GuidePresentation.pptx
PDF
Mega Projects Data Mega Projects Data
PPTX
Supervised vs unsupervised machine learning algorithms
PDF
Galatica Smart Energy Infrastructure Startup Pitch Deck
PDF
annual-report-2024-2025 original latest.
PPTX
Microsoft-Fabric-Unifying-Analytics-for-the-Modern-Enterprise Solution.pptx
Introduction-to-Cloud-ComputingFinal.pptx
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
Fluorescence-microscope_Botany_detailed content
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
Computer network topology notes for revision
climate analysis of Dhaka ,Banglades.pptx
iec ppt-1 pptx icmr ppt on rehabilitation.pptx
Clinical guidelines as a resource for EBP(1).pdf
mbdjdhjjodule 5-1 rhfhhfjtjjhafbrhfnfbbfnb
Quality review (1)_presentation of this 21
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
oil_refinery_comprehensive_20250804084928 (1).pptx
Business Ppt On Nestle.pptx huunnnhhgfvu
ALIMENTARY AND BILIARY CONDITIONS 3-1.pptx
Business Acumen Training GuidePresentation.pptx
Mega Projects Data Mega Projects Data
Supervised vs unsupervised machine learning algorithms
Galatica Smart Energy Infrastructure Startup Pitch Deck
annual-report-2024-2025 original latest.
Microsoft-Fabric-Unifying-Analytics-for-the-Modern-Enterprise Solution.pptx
Ad

R joins on dataframes

  • 1. Joins on Data frames ( Combining Data sets ) SachinSL sachinsl06@gmail.com
  • 2. Joining / Combining Data Sets • Generally, join is the mechanism which connects many data sets which are inter related. • Whenever the data needed are distributed over in many sources, the integration is done by considering proper key variables. • By joining two or more data sets in single object can help us in overall understanding data sets. • In R, we have numerous packages to combine the two or more data sets.
  • 3. WHAT WE VISUALIZE ? • In this section, we shall see the join operation on data frames which it most used data type. • There are many type of joins & shall use the dplyr package to simulate which are almost similar to SQL methods. • The dplyr package is widely used package for data manipulation in R programming
  • 4. Types of Joins • left_join() ( Left Join ) • right_join() ( Right Join ) • inner_join() ( Inner Join ) • full_join() ( Full/Outer Join )
  • 5. Example Table_1 Table_2 Student Physics Student Maths A 85 A 76 B 80 B 84 C 67 C 62 D 74 D 76 E 92 G 88 F 78 H 70
  • 6. LEFT JOIN Table_1 Table_2 Student Physics Student Maths A 85 A 76 B 80 B 84 C 67 C 62 D 74 D 76 E 92 G 88 F 78 H 70 Student Physics Maths A 85 76 B 80 84 C 67 62 D 74 76 E 92 NA F 78 NA
  • 7. RIGHT JOIN Table_1 Table_2 Student Physics Student Maths A 85 A 76 B 80 B 84 C 67 C 62 D 74 D 76 E 92 G 88 F 78 H 70 Student Physics Maths A 85 76 B 80 84 C 67 62 D 74 76 G NA 88 H NA 70
  • 8. INNER JOIN Table_1 Table_2 Student Physics Student Maths A 85 A 76 B 80 B 84 C 67 C 62 D 74 D 76 E 92 G 88 F 78 H 70 Student Physics Maths A 85 76 B 80 84 C 67 62 D 74 76
  • 9. FULL JOIN Table_1 Table_2 Student Physics Student Maths A 85 A 76 B 80 B 84 C 67 C 62 D 74 D 76 E 92 G 88 F 78 H 70 Student Physics Maths A 85 76 B 80 84 C 67 62 D 74 76 E 92 NA F 78 NA G NA 88 H NA 70