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)

相关推荐
weixin_307779131 小时前
PySpark实现ABC_manage_channel逻辑
开发语言·python·spark
??? Meggie2 小时前
【Python】保持Selenium稳定爬取的方法(防检测策略)
开发语言·python·selenium
酷爱码4 小时前
如何通过python连接hive,并对里面的表进行增删改查操作
开发语言·hive·python
画个大饼4 小时前
Go语言实战:快速搭建完整的用户认证系统
开发语言·后端·golang
喵先生!5 小时前
C++中的vector和list的区别与适用场景
开发语言·c++
Thomas_YXQ5 小时前
Unity3D Lua集成技术指南
java·开发语言·驱动开发·junit·全文检索·lua·unity3d
xMathematics6 小时前
计算机图形学实践:结合Qt和OpenGL实现绘制彩色三角形
开发语言·c++·qt·计算机图形学·cmake·opengl
yuanManGan8 小时前
C++入门小馆: 深入了解STLlist
开发语言·c++
北极的企鹅888 小时前
XML内容解析成实体类
xml·java·开发语言
BillKu8 小时前
Vue3后代组件多祖先通讯设计方案
开发语言·javascript·ecmascript