Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在R中合并许多不同的数据帧_R_Dataframe - Fatal编程技术网

在R中合并许多不同的数据帧

在R中合并许多不同的数据帧,r,dataframe,R,Dataframe,我有很多数据帧,我想把它们合并成一个大数据帧 例如,我有: month day time h 1 1 23 112 1 2 34 143 1 3 54 352 及 它们都有相同的列名,我想把它们加在一起,以便在大约60个月的大数据框架中,月份按升序排列。 我在想x我们可以使用rbind而不是cbind do.call(rbind, lst) 或者,如果我们使用的是data.table,我们可以 library(data.

我有很多数据帧,我想把它们合并成一个大数据帧

例如,我有:

month  day  time  h
1      1    23    112
1      2    34    143
1      3    54    352

它们都有相同的列名,我想把它们加在一起,以便在大约60个月的大数据框架中,月份按升序排列。
我在想
x我们可以使用
rbind
而不是
cbind

do.call(rbind, lst)
或者,如果我们使用的是
data.table
,我们可以

library(data.table)
rbindlist(lst)
或使用
dplyr

library(dplyr)
bind_rows(lst)

其中'lst'是'data.frame'的
列表

基于这两个数据集的预期输出是什么?。如果您只需要rbind它们
do.call(rbind,listofdataframes)
或者如果它是
merge
,那么
Reduce(function(…)merge(…)by=c('month','day','time'),listofdataframes)
您不想要
rbind
,而不是
cbind
?@akrun对不起,已经添加了预期的输出
library(data.table)
rbindlist(lst)
library(dplyr)
bind_rows(lst)