# Create example data.frames
parents <- data.frame(name=c("Sarah", "Max", "Qin", "Lex"),
                      sex=c("F", "M", "F", "M"),
                      age=c(41, 43, 36, 51))
children <- data.frame(parent=c("Sarah", "Max", "Qin"),
                       name=c("Oliver", "Sebastian", "Kai-lee"),
                       sex=c("M", "M", "F"),
                       age=c(5,8,7))

# Merge() creates a duplicated "name" column:
# (not anymore)
merge(parents, children, by.x = "name", by.y = "parent")
##   name sex.x age.x    name.y sex.y age.y

# FHE 20 Feb 2018
# try it with two "by" columns
merge(parents, children, by.x = c("name","sex"), by.y = c("parent","sex"))
##   name sex age.x    name.y age.y


