r merge 用法

来源:互联网 发布:所以木工软件 编辑:程序博客网 时间:2024/05/16 04:24

在数据操纵过程中经常需要使用交叉查询两张表,在SQL语句中主要通过inner join, left join, right join, outer join 等方法来实现。

R里面有个函数merge 也提供了类似的功能。

具体使用说明如下:

 

merge(x, y, by = intersect(names(x), names(y)),by.x = by, by.y = by, all = FALSE, all.x = all, all.y = all,      sort = TRUE, suffixes = c(".x",".y"),      incomparables = NULL, ...)
#秘笈在这里
the default value of 
all = FALSE gives a natural join, a special case of an inner join. 
all.x = TRUE gives a left (outer) join,
all.y = TRUE aright (outer) join,
all = TRUE a (full) outer join
 
 

 

0 0
原创粉丝点击