r - R) 来自“Large vtcrs_list_of”的嵌套列表的汇总维度表
问题描述
我拥有的数据是大型嵌套数据集,我将 nrow() 应用于每个嵌套列表。
map(.x=df, .f=dim)
[[1]]
[1] 9 13
[[2]]
[1] 9 13
...(omit)
[[1999]]
[1] 1 13
[[2000]]
[1] 1 13
df %>% lapply(., nrow)
[[1]]
[1] 9
[[2]]
[1] 9
...
[[1999]]
[1] 1
[[2000]]
[1] 1
那么,如何创建一个表来汇总 Large vtcrs_list_of 中每个列表的行数?喜欢
nested nrow
list1 9
list2 9
...
list1999 1
list2000 1
解决方案
这应该工作
listname <- paste("list", 1:2000, sep = "")
nrows <- df %>% sapply(., nrow)
final_df <- data.frame(listname, nrows)
推荐阅读
- excel - 从源文件夹到目标文件夹的文件夹列表复制vba
- python - 使用while循环更新多个函数中使用的分配变量 - PYTHON
- java - 如何在 Spring 中将 @Repository 添加到非控制器类?
- python - 将 CSV 从 AWS S3 实例导入到 Numpy
- javascript - 如何使用 JS 根据不同的屏幕尺寸加载不同的 HTML 内容
- devops - 如何使用 Google Cloud Run 将 zuul 注册到 eureka?
- c++ - C ++,一种在矢量调整大小后更新指针并在不复制的情况下擦除矢量对象的方法?
- constraint-programming - 问:谷歌或工具,连接弧
- css - 什么是重置默认值,为什么要这样做?CSS
- java - 如何在 Active MQ 5.x 中启动线程会话