filter_categorize: Categorize continuous variables

Description Usage Arguments Value Examples

View source: R/filter_categorize.R

Description

Categorize continuous variables

Usage

1
2
3
4
5
6
7
8
filter_categorize(
  sam_table,
  sample_condition,
  new_label,
  nbins = NULL,
  bin_breaks = c(),
  bin_labels = c()
)

Arguments

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

Value

A list with an updated sample table and before/after plots

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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

hiplot/animalcules documentation built on March 1, 2021, 12:04 a.m.