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
相关推荐
岭子笑笑9 小时前
vant 4 之loading组件源码阅读
前端
q_19132846959 小时前
基于SpringBoot2+Vue2的行业知识答题考试系统
java·vue.js·spring boot·mysql·毕业设计·计算机毕业设计·演示文稿
hxmmm9 小时前
自定义封装 vue多页项目新增项目脚手架
前端·javascript·node.js
ETA89 小时前
JS执行机制揭秘:你以为的“顺序执行”,其实是V8引擎在背后搞事情!
前端·javascript
鹏北海-RemHusband9 小时前
微前端实现方式:HTML Entry 与 JS Entry 的区别
前端·javascript·html
瘦的可以下饭了10 小时前
3 链表 二叉树
前端·javascript
我那工具都齐_明早我过来上班10 小时前
WebODM生成3DTiles模型在Cesium地图上会垂直显示问题解决(y-up-to-z-up)
前端·gis
粉末的沉淀10 小时前
jeecgboot:electron桌面应用打包
前端·javascript·electron
1024肥宅10 小时前
浏览器相关 API:DOM 操作全解析
前端·浏览器·dom