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)

相关推荐
阳光阿盖尔6 分钟前
EasyExcel的基本使用——Java导入Excel数据
java·开发语言·excel
蔚一8 分钟前
Java设计模式—面向对象设计原则(三) -----> 依赖倒转原则DIP(完整详解,附有代码+案例)
java·开发语言·设计模式·intellij-idea·依赖倒置原则
liang899913 分钟前
SpringSecurity原理解析(七):权限校验流程
java·开发语言
LQS202014 分钟前
基于Python实现一个浪漫烟花秀
开发语言·python
QXH20000015 分钟前
数据结构—单链表
c语言·开发语言·数据结构
梅如你16 分钟前
python批量对遥感影像进行归一化与数据清洗
开发语言·python
imaima66617 分钟前
数据结构----栈和队列
开发语言·数据结构
sinat_2765225721 分钟前
C++中move的使用
开发语言·c++
Langneer22 分钟前
Qt 状态机编程,双层状态机,实现暂停恢复
开发语言·qt
搁浅°87922 分钟前
IO文件拷贝
java·开发语言