R语言【taxa】——roots(),stems(),subtaxa(),supertaxa():获取根节点、茎节点、子类群和父类群

roots(x, subset = NULL)

在 taxonomy 中查找根节点类群的索引值。

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

> roots(x)
[1] 1

> roots(x, subset = 2:8)
[1] 2 6

stems(x, value = NULL, ...)

返回每个类群的茎节点的索引值。

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

> stems(x)
[[1]]
[1] 1 2

[[2]]
[1] 6 7

> stems(x, value = tax_name(x))
[[1]]
[1] "Carnivora" "Felidae"  

[[2]]
[1] "Carnivora" "Felidae"  

> x
<taxonomy[10]>
1: Carnivora
└─2: Felidae
  └─3: Panthera
    ├─4: Panthera leo
    └─5: Panthera tigris
6: Carnivora
└─7: Felidae
  └─8: Panthera
    ├─9: Panthera leo
    └─10: Panthera tigris

subtaxa(x, subset = NULL, max_depth = NULL, include = FALSE, value = NULL, ...)

返回所有子类群的索引值。

Generate example data

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

The indexes of all subtaxa (with subtaxa of subtaxa, etc) for each taxon

subtaxa(x)

The indexes of immediate subtaxa (without subtaxa of subtaxa, etc) for each taxon

subtaxa(x, max_depth = 1)

Return something other than index

subtaxa(x, value = tax_name(x))

Include each taxon with its subtaxa

subtaxa(x, value = tax_name(x), include = TRUE)

Only return data for some taxa (faster than subsetting the whole result)

subtaxa(x, subset = 3)


supertaxa( x, subset = NULL, max_depth = NULL, include = FALSE, value = NULL, use_na = FALSE, ... )

返回所有父类群的索引值。

Generate example data

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

The indexes of all supertaxa (with supertaxa of supertaxa, etc) for each taxon

supertaxa(x)

Return something other than index

supertaxa(x, value = tax_name(x))

Include each taxon with its supertaxa

supertaxa(x, value = tax_name(x), include = TRUE)

Only return data for some taxa (faster than subsetting the whole result)

supertaxa(x, subset = 3)

相关推荐
caimouse8 分钟前
ReactOS 窗口系统分析(14):计时器/属性/加速键/热键 — timer.c + prop.c + accelerator.c + hotkey.c
c语言·开发语言·reactos
circuitsosk15 分钟前
Python 模块与包管理:import 机制、虚拟环境与 pip 完全指南
开发语言·python·pip·依赖管理·模块与包
就叫飞六吧15 分钟前
两道门:X-Frame-Options 和 SameSite 到底谁管什么
开发语言·chrome·ai编程
fl17683130 分钟前
基于C#WPF实现的内存加速球清理类似360加速球内存清理
开发语言·c#·wpf
weixin_4407305034 分钟前
python+request实现接口-小结
开发语言·python
ZJU_统一阿萨姆1 小时前
【算子开发】扫描(Scan)与前缀和
开发语言·arm开发·架构·系统架构·硬件架构
-凌凌漆-1 小时前
【C语言】结构体typedef struct与struct的区别
c语言·开发语言
for_ever_love__1 小时前
PySpark学习: 数据输出
开发语言·python·学习·spark
言乐62 小时前
Python实现自动拉人脚本示例
开发语言·windows·python·django·pygame
啊啊啊啊啊!!!!2 小时前
【c++】二叉搜索树
开发语言·c++