Last active
July 1, 2017 04:14
-
-
Save yuifu/e80ac66768f432b4540f7de8d6714a10 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Installation | |
# install.packages("dplyr") | |
library(dplyr) | |
df1 = data.frame( | |
A=c("A1", "A2", "A3", "A4") | |
) | |
df2 = data.frame( | |
B=c("A1", "A2", "A3", "A4", "A5"), | |
D=c("D1", "D2", "D3", "D4", "D5") | |
) | |
df3 = merge(df1, df2, by.x="A", by.y="B", all.x=TRUE) | |
colnames(df3)[2] = "C" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment