# Data Frame Utama {Producers}
producers <- data.frame(
surname = c("Oswaldo","Noel","Dio","Bimo","Kocun"),
nationality = c("US","US","UK","US","Poland"),
stringsAsFactors=FALSE)
# Data Frame yang akan digabungkan
movies <- data.frame(
surname = c("Oswaldo",
"Noel",
"Dio",
"Dio",
"Oswaldo",
"Bimo",
"Kocun"),
title = c("Super 8",
"Taxi Driver",
"Psycho",
"North by Northwest",
"Catch Me If You Can",
"Reservoir Dogs","Chinatown"),
stringsAsFactors=FALSE)
# Menggabungkan Dua Data Frame
m1 <- merge(producers, movies, by.x = "surname")
m1
## surname nationality title
## 1 Bimo US Reservoir Dogs
## 2 Dio UK Psycho
## 3 Dio UK North by Northwest
## 4 Kocun Poland Chinatown
## 5 Noel US Taxi Driver
## 6 Oswaldo US Super 8
## 7 Oswaldo US Catch Me If You Can