Keep Original Row Order when Merging Data (Example) | Base R vs. dplyr Join | merge() & inner_join()

Published: 10 October 2021
on channel: Statistics Globe
534
17

How to retain the order of the rows of a data frame when merging data in the R programming language. More details: https://statisticsglobe.com/keep-orig...
R code of this video:

data1 <- data.frame(id = c(1:5, 3, 4), # Create first example data
x1 = letters[1:7],
x2 = "x")

data2 <- data.frame(id = 3:6, # Create second example data
y1 = letters[1:4],
y2 = "y")

data_merge <- merge(data1, data2) # Apply merge function

install.packages("dplyr") # Install dplyr package
library("dplyr") # Load dplyr package

data_join <- inner_join(data1, data2) # Apply inner_join function

Follow me on Social Media:
Facebook – Statistics Globe Page:   / statisticsglobecom  
Facebook – Group for Discussions & Questions:   / statisticsglobe  
LinkedIn – Statistics Globe Page:   / statisticsglobe  
LinkedIn – Group for Discussions & Questions:   / 12555223  
Twitter:   / joachimschork  

Music by bensound.com


On this page of the site you can watch the video online Keep Original Row Order when Merging Data (Example) | Base R vs. dplyr Join | merge() & inner_join() with a duration of hours minute second in good quality, which was uploaded by the user Statistics Globe 10 October 2021, share the link with friends and acquaintances, this video has already been watched 534 times on youtube and it was liked by 17 viewers. Enjoy your viewing!