r - 将R中的数据框与名称水平组合
问题描述
我有一组 12 个数据帧(DF1、DF2、... DF12),格式类似:
> DF1
# A tibble: 12 x 6
month mean max min sd n
<chr> <chr> <chr> <chr> <chr> <int>
1 January 1.22 x x x x
2 February 2.23 x x x x
3 March 4.86 x x x x
4 April 7.82 x x x x
5 May - - - - x
6 June - - - - x
7 July - - - - x
8 August - - - - x
9 September - - - - x
10 October - - - - x
11 November - - - - x
12 December - - - - x
数据框总是相似的(12X6),列名也是相似的(月、平均值、最大值、最小值、标准差、n)。如何水平组合 12 个数据帧以获得类似的东西(上面有 DF 的名称):
"name of the DF1" "name of the DF2" "name of the DF3" ....
month mean.x max.x min.x sd.x n.x mean.y max.y min.y sd.y n.y
1 January - - - - - - - - - -
2 February - - - - - - - - - -
3 March - - - - - - - - - -
4 April - - - - - - - - - -
5 May - - - - - - - - - -
6 June - - - - - - - - - -
7 July - - - - - - - - - -
8 August - - - - - - - - - -
9 September - - - - - - - - - -
10 October - - - - - - - - - -
11 November - - - - - - - - - -
12 December - - - - - - - - - -
我有一个包含我的 12 个数据框的列表:
var_names <- ls(envir = globalenv(), pattern = "^Final_analysis")
DF<- mget(var_names)
解决方案
dplyr::bind_cols(DF)
可以做到这一点。
推荐阅读
- .net - 通过编译为ast然后反编译来重组.net代码
- python - 使用 Boto 自动上传到 AWS S3 存储桶 Yields Expired Token Error
- python - 使用 Opencv 进行人脸检测
- firebase - 具有多个字段的 Firestore 分布式计数器
- node.js - 向 mongoDB 插入数据时显示 db 未定义
- python - 使硒无法检测的措施
- sql - Visual Studio SQL 返回重复值
- spring - java_options 中的第二个弹簧配置文件
- javascript - 为什么在 JavaScript 对象的 getter 和 setter 上使用 delete?
- javascript - 原生 JS 使用每个父类上的计数器重置添加类