Skip to contents

This function aggregates (accidentally) duplicated taxa in relevés.

Usage

aggregate_repeated(x, unicols, FUN = max)

Arguments

x

data.frame A relevé table where some columns (unicols) contain data relative to taxa (name, layer, sureness, etc.) and all other columns correspond to relevés (with numeric values or ordered factors).

unicols

vector A numeric or character vector with the indices or names of the columns that will produce unique combinations of values in each line. I.e., two rows will be aggregated if all the values in the columns selected by unicol are exactly the same.

FUN

function The functionthat will be used to aggregate the data values of all columns except unicols. This is passed to aggregate. Defaults to max.

Value

A data.frame as x possibly with some rows aggregated (merged).

Details

This function aggregates (merges) repeated taxa in a relevé table and is mainly thought for accidental repetitions of the same taxon in the same relevé or in the same relevé table, i.e same name, same layer, same sureness etc. The rows to be merged can have the same or different abundance-cover indices or cover values and will be merged using FUN. Abundance-cover indices must be stored in ordered factors and cover values as numeric. By default FUN = max is used with the following rationale: if the author truly records twice the same taxon, we consider the highest cover-abundance index or cover value as the relevant one, as the author has seen that taxon at least with the highest value during his assessment. However, in same cases, it is also possible that the lower cover-abundance index or cover value is the correct one (e.g. when the author increases the relevé area size and records the same taxon by mistake, instead of correcting it). This function is thought for the cleaning of original relevés or original relevé tables, and is not intended to merge taxa from different layers or to merge rows after taxonomic harmonization or taxonomic pruning (in such cases the merging of abundance-cover indices or cover values must be combined differently and wisely). All columns except unicols will be aggregated, therefore columns that are not intended to produce unique combinations of values for aggregation or do not contain relevés must be excluded previously.

Author

Tiago Monteiro-Henriques. E-mail: tmh.dev@icloud.com.