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)

相关推荐
AI+程序员在路上1 分钟前
VS Code 完全使用指南:下载、安装、核心功能与 内置AI 编程助手实战
开发语言·人工智能·windows·开源
invicinble8 分钟前
这里对java的知识体系做一个全域的介绍
java·开发语言·python
catchadmin17 分钟前
使用 PHP TrueAsync 改造 Laravel 协程异步化的可行路径
开发语言·php·laravel
wbs_scy23 分钟前
【Linux 线程进阶】进程 vs 线程资源划分 + 线程控制全详解
java·开发语言
AI人工智能+电脑小能手1 小时前
【大白话说Java面试题】【Java基础篇】第15题:JDK1.7中HashMap扩容为什么会发生死循环?如何解决
java·开发语言·数据结构·后端·面试·哈希算法
郑州光合科技余经理2 小时前
同城O2O海外版二次开发实战:从支付网关到配送算法
开发语言·前端·后端·算法·架构·uni-app·php
南子北游3 小时前
Python学习(基础语法1)
开发语言·python·学习
张健11564096483 小时前
使用信号量限制并发数量
开发语言·c++
糯米团子7493 小时前
Web Worker
开发语言·前端·javascript
我命由我123454 小时前
JavaScript 开发 - 获取函数名称、获取函数参数数量、获取函数参数名称
开发语言·前端·javascript·css·html·html5·js