R语言【taxa】——n_subtaxa(),n_supertaxa():每个类群的子类群数量和父类群数量

Package taxa version 0.4.2


n_subtaxa(x, subset = NULL, max_depth = NULL, include = FALSE)

参数【x】:获取子类群的对象,比如 taxonomy。

参数【subset】:检索的树的子集。索引或名称。

参数【max_depth】:挖掘的等级深度。比如,max_depth = 1 表示值返回直接子类群。默认返回所有子类群。

参数【include】:为TRUE时,输出每个类群的信息。

复制代码
> x <- taxonomy(c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo',
+                 'Panthera tigris', 'Ursidae', 'Ursus', 'Ursus arctos'),
+               supertaxa = c(NA, 1, 2, 3, 3, 1, 6, 7))
> x

<taxonomy[8]>
1: Carnivora
├─2: Felidae
│ └─3: Panthera
│   ├─4: Panthera leo
│   └─5: Panthera tigris
└─6: Ursidae
  └─7: Ursus
    └─8: Ursus arctos
复制代码
> n_subtaxa(x)
[1] 7 3 2 0 0 2 1 0
复制代码
> n_subtaxa(x, max_depth = 1)
[1] 2 1 2 0 0 1 1 0

n_supertaxa(x, subset = NULL, max_depth = NULL, include = FALSE)

参数同 n_subtaxa()。

复制代码
> x <- taxonomy(c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo',
+                 'Panthera tigris', 'Ursidae', 'Ursus', 'Ursus arctos'),
+               supertaxa = c(NA, 1, 2, 3, 3, 1, 6, 7))

> n_supertaxa(x)
[1] 0 1 2 3 3 1 2 3

> n_supertaxa(x, subset = 1:3)
[1] 0 1 2
相关推荐
风清云淡_A1 分钟前
【REACT16】react老项目版本依赖适配问题
前端·react.js
jump6803 分钟前
【react】 useEffect
前端
前端小咸鱼一条4 分钟前
16.React性能优化SCU
前端·react.js·性能优化
起风了___7 分钟前
Flutter 全局音频播放单例实现(附完整源码)——基于 just_audio 的零依赖方案
前端·flutter
im_AMBER7 分钟前
React 09
前端·javascript·笔记·学习·react.js·前端框架
用户4099322502128 分钟前
快速入门Vue模板里的JS表达式有啥不能碰?计算属性为啥比方法更能打?
前端·ai编程·trae
非专业程序员19 分钟前
HarfBuzz 实战:五大核心API 实例详解【附iOS/Swift实战示例】
前端·程序员
DreamMachine26 分钟前
Flutter 开发的极简风格音乐播放器
前端·flutter
前端老宋Running32 分钟前
前端防抖与节流一篇讲清楚
前端·面试
ejinxian35 分钟前
Rust UI 框架GPUI 与 Electron 的对比
前端·javascript·electron