Aggregate (accidentally) duplicated taxa in relevés
Source:R/aggregate_repeated.R
aggregate_repeated.Rd
This function aggregates (accidentally) duplicated taxa in relevés.
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 (withnumeric
values orordered factor
s).- unicols
vector
Anumeric
orcharacter 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 byunicol
are exactly the same.- FUN
function
Thefunction
that will be used to aggregate the data values of all columns exceptunicols
. This is passed toaggregate
. Defaults tomax
.
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 factor
s 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.