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

相关推荐
yddddddy1 小时前
css的基本知识
前端·css
昔人'1 小时前
css `lh`单位
前端·css
MarkHard1231 小时前
如何利用redis使用一个滑动窗口限流
数据库·redis·缓存
island13142 小时前
【Redis#10】渐进式遍历 | 数据库管理 | redis_cli | RES
数据库·redis·bootstrap
心想事成的幸运大王2 小时前
Redis的过期策略
数据库·redis·缓存
倔强的石头_2 小时前
CentOS 上安装KingbaseES(ISO包)详细教程
数据库
Nan_Shu_6143 小时前
Web前端面试题(2)
前端
知识分享小能手3 小时前
React学习教程,从入门到精通,React 组件核心语法知识点详解(类组件体系)(19)
前端·javascript·vue.js·学习·react.js·react·anti-design-vue
2401_897930063 小时前
使用Docker轻松部署Neo4j图数据库
数据库·docker·neo4j
诗句藏于尽头3 小时前
Django模型与数据库表映射的两种方式
数据库·python·django