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)

相关推荐
LIN-JUN-WEI12 分钟前
[ESP32]VSCODE+ESP-IDF环境搭建及blink例程尝试(win10 win11均配置成功)
c语言·开发语言·ide·vscode·单片机·学习·编辑器
望获linux1 小时前
【Linux基础知识系列】第四十三篇 - 基础正则表达式与 grep/sed
linux·运维·服务器·开发语言·前端·操作系统·嵌入式软件
留不住丨晚霞2 小时前
说说SpringBoot常用的注解?
java·开发语言
hardStudy_h2 小时前
C++——内联函数与Lambda表达式
开发语言·jvm·c++
艾莉丝努力练剑2 小时前
【C语言】学习过程教训与经验杂谈:思想准备、知识回顾(三)
c语言·开发语言·数据结构·学习·算法
witton4 小时前
Go语言网络游戏服务器模块化编程
服务器·开发语言·游戏·golang·origin·模块化·耦合
枯萎穿心攻击4 小时前
ECS由浅入深第三节:进阶?System 的行为与复杂交互模式
开发语言·unity·c#·游戏引擎
Jerry Lau4 小时前
go go go 出发咯 - go web开发入门系列(一) helloworld
开发语言·前端·golang
nananaij4 小时前
【Python基础入门 re模块实现正则表达式操作】
开发语言·python·正则表达式
Micro麦可乐4 小时前
Java常用加密算法详解与实战代码 - 附可直接运行的测试示例
java·开发语言·加密算法·aes加解密·rsa加解密·hash算法