Skip to content

Instantly share code, notes, and snippets.

@toyeiei
Last active Jan 31, 2019
Embed
What would you like to do?
glimpse dplyr 3
# create example dataframe
df1 <- data.frame(id = 1:5, names = c("John", "Andy", "Otis", "Maive", "Jackson"))
df2 <- data.frame(id = c(1:4,6), grades = c("A", "B", "A", "F", "D"))
# join tables
inner_join(df1, df2, by = "id")
left_join(df1, df2, by = "id")
full_join(df1, df2, by = "id")
# assign to a new dataframe
new_df <- full_join(df1, df2, by = "id")
glimpse(new_df)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment