我想外部连接以下两个表

时间:2019-03-13 01:05:12

标签: r

enter image description here

enter image description here

这是我的代码:

X = read.csv("cpm-gender.csv")
Y = read.csv("page-level-gender.csv")
Z = merge(Y,X,by = c("Gender"),all = TRUE)


Z = merge(X,Y,by = c("Gender","Average_Age"),all = TRUE)
  

fix.by(by.x,x)中的错误:“ by”必须指定唯一有效的列

Z = merge(X,Y,by = "Gender",all = TRUE)
  

merge.data.frame(X,Y,by =“ Gender”,all = TRUE)中的错误:     不允许使用负长度向量。

请有人给我一个解决方案,将两者结合起来对组合数据进行机器学习。

1 个答案:

答案 0 :(得分:0)

我认为您可能正在尝试合并错误的列名。试试:

Z = merge(X,Y,by = c("Gender","Average.Age"),all = TRUE)

Z = merge(X,Y, by = "Average.Age", all = TRUE)