This function checks if specified rows exist in a data frame, and if not, adds them with all values set to 0. Useful for ensuring consistent KO representation across samples.
add_rows_if_not_exists(
module_abundance,
add_rows = c("K14126", "K14128", "K14127")
)The original data frame with additional rows (if any were missing) where all values are set to 0. Row and column names are preserved.
A data frame with row names representing KO identifiers (e.g., K numbers) and numeric abundance values
A character vector of row names (KO identifiers) that should be present in the output. Defaults to c("K14126","K14128","K14127")