merge()函数

您所在的位置:网站首页 r语言names是什么 merge()函数

merge()函数

2024-07-15 04:13| 来源: 网络整理| 查看: 265

1. 函数功能 Merge two data frames by common columns or row names, or do other versions of database join operations.

通过共同列或者行名合并数据框,或者执行其他合并操作

2.函数语法 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"), no.dups = TRUE, incomparables = NULL, ...) 3. 函数参数 1) x,y x, y data frames, or objects to be coerced to one.

要合并的数据框或者对象

2) by, by.x, by.y by, by.x, by.y specifications of the columns used for merging.

指定用于合并的列

By default the data frames are merged on the columns with names they both have, but separate specifications of the columns can be given by by.x and by.y. The rows in the two data frames that match on the specified columns are extracted, and joined together. If there is more than one match, all possible matches contribute one row each.

默认两个数据框通过共同的列合并,也可通过参数by.x和by.y指定。满足指定列的行被提取出来,并合并到一起。 如果有多个匹配项,则所有可能的匹配项各贡献一行。

当两个数据框有相同的列名: 名称


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3