I've done some research about this (here and here), but I haven't found what I actually want to achieve. The closest I've found to what I'm looking for is here, but the code doesn't seem to work or do what I desire. Besides, I found out that rbindlist
has been deprecated in favour of bind_rows
, but I haven't been able to use bind_rows
to achieve what I want.
我有一个30个数据框的列表,每个数据框具有相同的行数和列数,以及相同的列数据类型(尽管每一列可以是连续的和分类的)。我想将它们合并为具有相同行和列数的单个数据框,但每个单元格是数据框列表中对应于连续,整数和分类列的30个单元格的均值/中位数/多数表决,分别。这是一个包含三个数据帧的示例:
df 1:
A B C
2.3 5 3
12 3 1
0.4 13 2
df_2:
A B C
4.3 23 1
1 7 2
0.4 10 2
df_3:
A B C
1.3 3 3
2.2 4 2
12.4 10 1
结果数据框将是这样的:
df_result:
A B C
2.63 5 3
5.06 4 2
4.4 10 2
结合每种数据类型的更合适方式的任何指导也将受到高度赞赏。