View source: R/mbX_functions.R
ezclean | R Documentation |
Processes microbiome and metadata files (e.g., 16S rRNA sequencing data) to produce an analysis-ready dataset. Supports CSV, TXT, and 'Excel' file formats. This function validates file formats, reads the data, and merges the datasets by the common column 'SampleID'. If a 'Taxonomy' column exists, the data are filtered to include only rows matching the provided taxonomic level.
ezclean(microbiome_data, metadata, level = "d")
microbiome_data |
A string specifying the path to the microbiome data file. |
metadata |
A string specifying the path to the metadata file. |
level |
A string indicating the taxonomic level for filtering the data (e.g., "genus"). |
A data frame containing the cleaned and merged dataset.
# Example usage (ensure that 'inst/extdata' contains the appropriate files,
# or modify this example to use your own data)
microbiome_data <- system.file("extdata", "microbiome.csv", package = "mbX")
metadata <- system.file("extdata", "metadata.csv", package = "mbX")
if (nzchar(microbiome_data) && nzchar(metadata)) {
cleaned_data <- ezclean(microbiome_data, metadata, "genus")
head(cleaned_data)
} else {
message("Sample data files not found.")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.