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

相关推荐
dorisrv1 小时前
优雅的React表单状态管理
前端
蓝瑟1 小时前
告别重复造轮子!业务组件多场景复用实战指南
前端·javascript·设计模式
老华带你飞1 小时前
旅游|基于Java旅游信息系统(源码+数据库+文档)
java·开发语言·数据库·vue.js·spring boot·旅游
释怀°Believe1 小时前
javaweb
数据库·sql·oracle
Clarence Liu1 小时前
redis学习 (1) 基础入门
数据库·redis·学习
dorisrv1 小时前
高性能的懒加载与无限滚动实现
前端
天生励志1232 小时前
Redis 安装部署
数据库·redis·缓存
北半球的夜2 小时前
emoji 表情符号保存问题
数据库·oracle
韭菜炒大葱2 小时前
别等了!用 Vue 3 让 AI 边想边说,字字蹦到你脸上
前端·vue.js·aigc
StarkCoder2 小时前
求求你,别在 Swift 协程开头写 guard let self = self 了!
前端