scale_variables: Data scaling adjusts each variable/feature

View source: R/process_normalization.R

scale_variablesR Documentation

Data scaling adjusts each variable/feature

Description

Data Normalization not only normalizes data by samples, but also scales data by variable/feature. Data scaling adjusts each variable/feature by a scaling factor computed based on the dispersion of the variable. The former is to change data distribution per sample and the latter is to put variable/feature into same distribution.

Usage

scale_variables(
   object,
   level = c(NULL, "Kingdom", "Phylum", "Class",
           "Order", "Family", "Genus",
           "Species", "Strain", "unique"),
   method = c("none", "mean_center", "zscore",
            "pareto", "range")
   )

Arguments

object

(Required). a phyloseq::phyloseq or SummarizedExperiment::SummarizedExperiment object.

level

(Optional). character. Summarization level (from rank_names(pseq), default: NULL).

method

(Optional). character. scaling methods. Options are:

  • "none", return the original data

  • "mean_center": values minus mean statistic.

  • "zscore": mean-centered and divided by the standard deviation of each variable.

  • "pareto": mean-centered and divided by the square root of the standard deviation of each variable.

  • "range": mean-centered and divided by the range of each variable. (default: "none").

Value

A phyloseq::phyloseq or SummarizedExperiment::SummarizedExperiment object with cleaned data.

Author(s)

Created by Hua Zou (12/02/2022 Shenzhen China)

Examples


## Not run: 
# phyloseq object
data("enterotypes_arumugam")
scale_variables(
  object = enterotypes_arumugam,
  level = "Phylum",
  method = "mean_center")

# SummarizedExperiment object
data("Zeybel_2022_protein")
scale_variables(
  Zeybel_2022_protein,
  method = "zscore")

## End(Not run)


HuaZou/MicrobiomeAnalysis documentation built on May 13, 2024, 11:10 a.m.