Skip to contents

Summarize samples by a grouping column in sample_info and then apply a count transformation to the summarized abundance matrix.

Usage

transform_samples(
  object,
  group_by,
  what = c("sum_intensity", "mean_intensity", "median_intensity"),
  method = c("relative", "log", "presence_absence", "clr"),
  pseudocount = 1,
  ...
)

Arguments

object

A microbiome_dataset object.

group_by

A column in sample_info.

what

Aggregation method used before transformation.

method

Transformation method.

pseudocount

A pseudocount added before transformations that require strictly positive values.

...

Other parameters passed to transform_counts().

Value

A transformed microbiome_dataset object.

Examples

data("global_patterns", package = "microbiomedataset")

x <- transform_samples(
  object = global_patterns,
  group_by = "SampleType",
  what = "sum_intensity",
  method = "relative"
)
attr(x@expression_data, "transform_method")
#> [1] "relative"