R语言【taxa】——is_*():检查对象是否为某个类

is_classification(x)

检查对象是否为 classification 类。


is_internode(x)

检查每个分类单元是否为节间。节间是指一个分类单元恰好有一个上级分类单元和

一个下级分类单元。这些分类群可以在不丢失它们之间的关系信息的情况下被移除。

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

is_internode(x)
复制代码
[1] FALSE  TRUE FALSE FALSE FALSE  TRUE  TRUE FALSE

is_leaf(x)

检查每个分类群是否为冠群。leaf 表示该类群没有下级分类群。

R 复制代码
x <- taxonomy(c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo',
'Panthera tigris', 'Ursidae', 'Ursus', 'Ursus arctos'),
supertaxa = c(NA, 1, 2, 3, 3, 1, 6, 7))
is_leaf(x)
复制代码
[1] FALSE FALSE FALSE  TRUE  TRUE FALSE FALSE  TRUE

is_root(x, subset = NULL)

检查每个分类群是否为起点类群。root 表示该类群没有上级分类群。

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

is_root(x)
is_root(x, subset = 2:8)
复制代码
[1]  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
复制代码
[1] FALSE  TRUE FALSE FALSE FALSE  TRUE FALSE FALSE

is_stem(x)

检查每个分类单元是否是一个茎节点。stem 是指从根到具有多个亚分类单元的第一个分类单元的任何分类单元。

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

is_stem(x)
复制代码
[1]  TRUE  TRUE FALSE FALSE FALSE

is_taxon(x)

检查对象是否为 taxon 类。

复制代码
> x <- taxon(c('A', 'B', 'C'))
> is_taxon(x)
[1] TRUE
> is_taxon(1:2)
[1] FALSE

is_taxonomy(x)

检查对象是否为 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))
> is_taxonomy(x)
[1] TRUE
> is_taxonomy(1:2)
[1] FALSE

is_taxon_authority(x)

检查对象是否为 taxon_authority 类。

复制代码
> x <- taxon_authority(c('Cham. & Schldl.', 'L.'),
+                      date = c('1827', '1753'))
> is_taxon_authority(x)
[1] TRUE
> is_taxon_authority(1:3)
[1] FALSE

is_taxon_db(x)

检查对象是否为 taxon_db 类。

复制代码
> x <- taxon_db(c('ncbi', 'ncbi', 'itis'))
> is_taxon_db(x)
[1] TRUE
> is_taxon_db(1:3)
[1] FALSE

is_taxon_id(x)

检查对象是否为 taxon_id 类。

复制代码
> x <- taxon_id(c('9606', '1386', '4890', '4345'), db = 'ncbi')
> is_taxon_id(x)
[1] TRUE
> is_taxon_id(1:3)
[1] FALSE

is_taxon_rank(x)

检查对象是否为 taxon_rank 类。

复制代码
> x <- taxon_rank(c('species', 'species', 'phylum', 'family'))
> is_taxon_rank(x)
[1] TRUE
> is_taxon_rank(1:3)
[1] FALSE

相关推荐
睡不醒男孩03082310 小时前
行业解决方案一:CLup助力金融行业构建自主可控PostgreSQL高可用数据库平台
数据库·金融·clup
风骏时光牛马10 小时前
Bash变量未加双引号导致文件名含空格解析异常实战案例
前端
Vennn10 小时前
Android自动化:使用 Web 方式实现某音未读消息检查与采集
前端·javascript·vue.js
Smilezyl10 小时前
为了搞懂 AI Agent,我用 6000 行 JS 代码手搓了一个零依赖的 Coding Agent
前端·javascript·github
海鸥-w10 小时前
前端学习python第三天笔记整理(list 列表,str字符串,tuple元组,set集合,dect,函数,类型注解)
前端·python·学习
flavor10 小时前
Vue3 大屏适配组件(Scale / Rem 双方案一键切换)
前端
用户0595401744610 小时前
把 AI Agent 记忆验证从手工比对换成 Pytest + 向量数据库,测试效率提升 10 倍
前端·css
要写代码11 小时前
2026-Css忘掉一切、归零再启-alpha和opacity
前端
光影少年11 小时前
前端如何和蓝牙物联网进行通信和兼容性问题
前端·物联网·掘金·金石计划
星栈11 小时前
我把售后模块砍到只剩 64 行:Rust 全栈 CRM 的 MVP 取舍实录
前端·后端·开源