filter_categorize {animalcules} | R Documentation |
Categorize continuous variables
filter_categorize(sam_table, sample_condition, new_label, nbins = NULL, bin_breaks = c(), bin_labels = c())
sam_table |
A sample x condition dataframe |
sample_condition |
Continuous variable to categorize |
new_label |
Column name for categorized variable |
nbins |
Auto select ranges for n bins/categories |
bin_breaks |
Manually select ranges for bins/categories |
bin_labels |
Manually label bins/categories |
A list with an updated sample table and before/after plots
library(SummarizedExperiment) data_dir = system.file('extdata/MAE.rds', package = 'animalcules') toy_data <- readRDS(data_dir) microbe <- MultiAssayExperiment::experiments(toy_data)[[1]] samples <- as.data.frame(colData(microbe)) result <- filter_categorize(samples, sample_condition = 'AGE', new_label='AGE_GROUP', bin_breaks=c(0,55,75,100), bin_labels=c('Young','Adult','Elderly')) result$sam_table result$plot.unbinned result$plot.binned