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

is_classification(x)

        检查对象是否为 classification 类。


is_internode(x)

        检查每个分类单元是否为节间。节间是指一个分类单元恰好有一个上级分类单元和
一个下级分类单元。这些分类群可以在不丢失它们之间的关系信息的情况下被移除。

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 表示该类群没有下级分类群。

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 表示该类群没有上级分类群。

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 是指从根到具有多个亚分类单元的第一个分类单元的任何分类单元。

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

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-01-24 21:42:01       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-01-24 21:42:01       100 阅读
  3. 在Django里面运行非项目文件

    2024-01-24 21:42:01       82 阅读
  4. Python语言-面向对象

    2024-01-24 21:42:01       91 阅读

热门阅读

  1. JLX12864带中文字库液晶屏的STM32驱动程序

    2024-01-24 21:42:01       39 阅读
  2. Oracle中一个过程怎么使用两个事务

    2024-01-24 21:42:01       54 阅读
  3. HJ8 合并表记录

    2024-01-24 21:42:01       49 阅读
  4. sklearn.cluster.Kmeans解析

    2024-01-24 21:42:01       44 阅读
  5. 力扣2765-最长交替子数组

    2024-01-24 21:42:01       69 阅读
  6. SpringBoot配置文件-application.yml

    2024-01-24 21:42:01       39 阅读