filter_constant_taxa()

filter_constant_taxa R Documentation

Filter Constant Taxa from Community Matrix

Description

Removes taxa that show no variation across all samples. A taxon is considered constant when its standard deviation is zero, meaning every sample has the same value. Constant taxa cannot contribute to any model likelihood and must be excluded before fitting. Filtering is applied regardless of the error family (binomial, Gaussian, Poisson, beta, etc.).

Usage

filter_constant_taxa(data_community_matrix = NULL)

Arguments

data_community_matrix

A numeric matrix with samples as rows and taxa as columns, as returned by ‘prepare_community_for_fit()’.

Details

Variation is assessed by computing ‘stats::sd()’ for each column via ‘purrr::map_dbl()’. A column is retained only when its standard deviation is strictly greater than zero. This family-agnostic approach replaces the previous binomial-only binarisation check and is now a tracked pipeline target.

Value

A numeric matrix of the same structure as the input, with all constant taxa (standard deviation equal to zero) removed. If no taxa are constant the input matrix is returned unchanged.

See Also

[prepare_community_for_fit()], [assemble_data_to_fit()]

Back to top