给定两个数据帧:
df1 = data.frame(CustomerId = c(1:6), Product = c(rep("Toaster", 3), rep("Radio", 3)))df2 = data.frame(CustomerId = c(2, 4, 6), State = c(rep("Alabama", 2), rep("Ohio", 1)))
df1# CustomerId Product# 1 Toaster# 2 Toaster# 3 Toaster# 4 Radio# 5 Radio# 6 Radio
df2# CustomerId State# 2 Alabama# 4 Alabama# 6 Ohio
我如何做到数据库样式,即sql样式,连接?也就是说,我如何获得:
df1
anddf2
:df1
anddf2
:df1
anddf2
df1
anddf2
额外信用:
如何执行SQL样式的选择语句?