mutate_fc: mutate_fc

View source: R/mutate_fc.R

mutate_fcR Documentation

mutate_fc

Description

Calculate fold change.

Usage

mutate_fc(
  object,
  control_sample_id,
  case_sample_id,
  mean_median = c("mean", "median"),
  return_mass_dataset = TRUE
)

Arguments

object

tidymass-class object.

control_sample_id

A character vector.

case_sample_id

A character vector

mean_median

mean or median.

return_mass_dataset

logical default TRUE

Value

object with fold change (fc) in variable_info.

Author(s)

Xiaotao Shen shenxt1990@outlook.com

Examples

library(massdataset)
library(magrittr)
library(dplyr)

data("liver_aging_pos")
liver_aging_pos

w_78 =
  liver_aging_pos %>%
  activate_mass_dataset(what = "sample_info") %>%
  dplyr::filter(group == "78W") %>%
  dplyr::pull(sample_id)

w_24 =
  liver_aging_pos %>%
  activate_mass_dataset(what = "sample_info") %>%
  dplyr::filter(group == "24W") %>%
  dplyr::pull(sample_id)


control_sample_id = w_24
case_sample_id = w_78

liver_aging_pos =
  mutate_fc(
    object = liver_aging_pos,
    control_sample_id = control_sample_id,
    case_sample_id = case_sample_id,
    mean_median = "mean"
  )

head(extract_variable_info(liver_aging_pos))

liver_aging_pos =
  mutate_fc(
    object = liver_aging_pos,
    control_sample_id = control_sample_id,
    case_sample_id = case_sample_id,
    mean_median = "median"
  )

head(extract_variable_info(liver_aging_pos))

extract_variable_info(liver_aging_pos) %>%
  ggplot(aes(fc, fc.1)) +
  geom_point()

tidymass/massstat documentation built on March 12, 2024, 6:24 a.m.