Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Joining Tables with dplyr
# install
install.packages('dplyr')
install.packages('readr')
# library
library(dplyr)
library(readr)
# import order data
order <- readr::read_csv('https://raw.githubusercontent.com/rsquaredacademy/datasets/master/order.csv')
order
# import customer data
customer <- readr::read_csv('https://raw.githubusercontent.com/rsquaredacademy/datasets/master/customer.csv')
customer
# inner join
customer %>%
inner_join(order)
# left join
customer %>%
left_join(order)
# right join
customer %>%
right_join(order)
# semi join
customer %>%
semi_join(order)
# anti join
customer %>%
anti_join(order)
# full join
customer %>%
full_join(order)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.