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
相关推荐
lijun_xiao200928 分钟前
前端最新Vue2+Vue3基础入门到实战项目全套教程
前端
90后的晨仔41 分钟前
Pinia 状态管理原理与实战全解析
前端·vue.js
杰克尼1 小时前
JavaWeb_p165部门管理
java·开发语言·前端
90后的晨仔1 小时前
Vue3 状态管理完全指南:从响应式 API 到 Pinia
前端·vue.js
90后的晨仔1 小时前
Vue 内置组件全解析:提升开发效率的五大神器
前端·vue.js
我胡为喜呀1 小时前
Vue3 中的 watch 和 watchEffect:如何优雅地监听数据变化
前端·javascript·vue.js
我登哥MVP1 小时前
Ajax 详解
java·前端·ajax·javaweb
非凡ghost2 小时前
Typora(跨平台MarkDown编辑器) v1.12.2 中文绿色版
前端·windows·智能手机·编辑器·软件需求
馨谙2 小时前
/dev/null 是什么,有什么用途?
前端·chrome
JamSlade3 小时前
流式响应 sse 系统全流程 react + fastapi为例子
前端·react.js·fastapi