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
相关推荐
小赵同学WoW5 分钟前
1-2 TypeScript 中的 `any` 与 `unknown`
前端
six_16 分钟前
C# 上位机(持续更新中)
前端·面试·c#
风雨_16 分钟前
Git Worktree sourcetree完整使用指南
前端
半个落月30 分钟前
React 组件通信进阶:useContext 与自定义 Hook 实战详解
前端·react.js
用户9210802628638 分钟前
ChatComposer 输入区改造:基于技能市场实现 Agent 输入框
前端
用户459892045651640 分钟前
一套 KMP 多仓库版本治理工作流:用 Version Catalog + CI 把发版流水线自动化
前端·kotlin
小赵同学WoW41 分钟前
1-4 TypeScript 中的 `number`、`bigint` 与 `string`
前端
小赵同学WoW1 小时前
1-3 `boolean` 与字面量类型
前端
光影少年1 小时前
react navite 长列表优化:FlatList / SectionList 原理与优化属性
前端·react native·react.js
cindershade1 小时前
鼠标 3D 倾斜卡片
前端