add_back_missing_plots_species_combinations: Add back missing plots x species combinations

View source: R/preparing_diversity.R

add_back_missing_plots_species_combinationsR Documentation

Add back missing plots x species combinations


date of creation : 26.01.21 In order to save storage, the diversity dataset for bacteria and soil fungi o not include all combinations of plots x species when a given species was not found in a given plot i.e. they do not contain zeros. They need to be added back in order to gain the complete set of studied plots (missing plots x species are not NA but measured, just the given species was not found). Code from Caterina Penone, for further explanations and rationale see Note : Only the columns Plot and Species are considered, any other columns will be filled with NA. This can cause problems if the dataset is later filtered for e.g. Year. Note : special case if the input dataset does not contain all Plots, if certain plots do not contain any species. This special case is detected and solved in this function.


add_back_missing_plots_species_combinations(diversity_dataset, all_plots)



A data.table of soilfuni or bacteria in the format of the synthesis diversity dataset, with at least the columns Plot, Species and value. #' @param all_plots a character vector containing the complete set of plots from the Exploratories. (AEG 1-50, HEG 1-50 and SEG 1-50). Is needed for the subfunction find_and_supplement_missing_plots.


A data.table in the same format as diversity_dataset, but with the previously missing plots x species added back as 0. Note : Only the columns Plot, Species and value are considered, any other columns will be filled with NA.

allanecology/BetaDivMultifun documentation built on Dec. 3, 2022, 12:30 p.m.