在数据操纵过程中经常需要使用交叉查询两张表,在SQL语句中主要通过inner join, left join, right join, outer join 等方法来实现。
R里面有个函数merge 也提供了类似的功能。
具体使用说明如下:
merge(x, y, by = intersect(names(x), names(y)), = by, = by, all = FALSE, = all, = all, sort = TRUE, suffixes = c(".x",".y"), incomparables = NULL, ...)#秘笈在这里the default value ofall = FALSE
gives a natural join, a special case of an inner join.= TRUE
gives a left (outer) join,= TRUE
aright (outer) join,all = TRUE
a (full) outer join