R语言【taxlist】——count_taxa():统计 taxlist 对象中的类群数量

Package taxlist version 0.2.4


Description

统计 taxlist 对象或包含分类单元名称的字符向量中的分类单元的数量。


Usage

R 复制代码
count_taxa(object, data, ...)

## S4 method for signature 'character,missing'
count_taxa(object, na.rm = TRUE, ...)

## S4 method for signature 'factor,missing'
count_taxa(object, na.rm = TRUE, ...)

## S4 method for signature 'taxlist,missing'
count_taxa(object, level, ...)

## S4 method for signature 'formula,taxlist'
count_taxa(object, data, include_na = FALSE, suffix = "_count", ...)

Arguments

参数【object】:包含了分类学列表或公式的一个对象。

参数【data】:formula 方法中的 taxlist 类对象。

参数【...】:方法之间传递的进一步参数。

参数【na.rm】:逻辑值,NAs 是否必须从输入向量中移除。

参数【level】:用来指示期望统计的分类群的分类等级的字符值。

参数【include_na】:逻辑值,指示分类群特征中的 NA 值是应该被考虑用于分类群计数还是直接忽略(仅用于 formula 方法)。

参数【suffix】:在输出数据框中被统计的分类等级的后缀字符串值(仅用于 formula 方法)。


Detail

为了方便起见,编写这个函数是为了减少对 taxlist 对象中的分类进行计数的代码,它只是一个 length() 的包装器。


Value

带分类群数目的整数。


Examples

++统计某一列(通常列中的分类群均为同一分类等级)++

R 复制代码
count_taxa(iris$Species)
复制代码
[1] 3

++统计某数据集(不对这些分类群进行等级区分)++

R 复制代码
count_taxa(Easplist)
复制代码
[1] 3887

++统计某数据集中特定分类等级++

R 复制代码
count_taxa(Easplist, level = "species")
复制代码
[1] 2521

++使用 formula 方法传递数据集(对各个分类等级的分类群进行统计)++

R 复制代码
count_taxa(~life_form, Easplist, include_na = TRUE)
复制代码
            life_form taxa_count
1    acropleustophyte          8
2         chamaephyte         25
3      climbing_plant         25
4  facultative_annual         20
5                 NAs       3576
6     obligate_annual        114
7        phanerophyte         26
8    pleustohelophyte          8
9          reed_plant         14
10      reptant_plant         19
11      tussock_plant         52
相关推荐
郑州光合科技余经理5 天前
代码展示:PHP搭建海外版外卖系统源码解析
java·开发语言·前端·后端·系统架构·uni-app·php
feifeigo1235 天前
matlab画图工具
开发语言·matlab
dustcell.5 天前
haproxy七层代理
java·开发语言·前端
norlan_jame5 天前
C-PHY与D-PHY差异
c语言·开发语言
多恩Stone5 天前
【C++入门扫盲1】C++ 与 Python:类型、编译器/解释器与 CPU 的关系
开发语言·c++·人工智能·python·算法·3d·aigc
QQ4022054965 天前
Python+django+vue3预制菜半成品配菜平台
开发语言·python·django
遥遥江上月5 天前
Node.js + Stagehand + Python 部署
开发语言·python·node.js
m0_531237175 天前
C语言-数组练习进阶
c语言·开发语言·算法
Railshiqian5 天前
给android源码下的模拟器添加两个后排屏的修改
android·开发语言·javascript
雪人不是菜鸡5 天前
简单工厂模式
开发语言·算法·c#