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
相关推荐
鹿心肺语几秒前
前端HTML转PDF的两种主流方案深度解析
前端·javascript
海石19 分钟前
去到比北方更北的地方—2025年终总结
前端·ai编程·年终总结
一个懒人懒人26 分钟前
Promise async/await与fetch的概念
前端·javascript·html
Mintopia32 分钟前
Web 安全与反编译源码下的权限设计:构筑前后端一致的防护体系
前端·安全
输出输入34 分钟前
前端核心技术
开发语言·前端
Mintopia38 分钟前
Web 安全与反编译源码下的权限设计:构建前后端一体的信任防线
前端·安全·编译原理
林深现海1 小时前
Jetson Orin nano/nx刷机后无法打开chrome/firefox浏览器
前端·chrome·firefox
EchoEcho1 小时前
深入理解 Vue.js 渲染机制:从声明式到虚拟 DOM 的完整实现
vue.js
黄诂多1 小时前
APP原生与H5互调Bridge技术原理及基础使用
前端
前端市界1 小时前
用 React 手搓一个 3D 翻页书籍组件,呼吸海浪式翻页,交互体验带感!
前端·架构·github