merge_mass_dataset: merge_mass_dataset

View source: R/merge_mass_dataset.R

merge_mass_datasetR Documentation

merge_mass_dataset

Description

Merge two mass_dataset objects. More information can be found here https://tidymass.github.io/massdataset/articles/process_info.html

Usage

merge_mass_dataset(
  x,
  y,
  sample_direction = c("left", "right", "full", "inner"),
  variable_direction = c("left", "right", "full", "inner"),
  sample_by = c("sample_id"),
  variable_by = c("variable_id", "mz", "rt")
)

Arguments

x

(required) A mass_dataset class object.

y

(required) A mass_dataset class object.

sample_direction

How to merge samples, should be left, right, inner or full. See ?left_join

variable_direction

How to merge variables, should be left, right, inner or full.

sample_by

merge samples by what columns from sample_info.

variable_by

merge variables by what columns from variable_info

Value

A merged mass_dataset.

Author(s)

Xiaotao Shen shenxt1990@outlook.com

Examples

data("expression_data")
data("sample_info")
data("variable_info")

object =
  create_mass_dataset(
    expression_data = expression_data,
    sample_info = sample_info,
    variable_info = variable_info,
  )

x = object[1:3, 5:7]
y = object[2:4, 6:8]

####full merge for samples and variables
z1 =
merge_mass_dataset(
  x = x,
  y = y,
  sample_direction = "full",
  variable_direction = "full"
)

####inner merge for samples and full merge for variables
z2 =
  merge_mass_dataset(
    x = x,
    y = y,
    sample_direction = "inner",
    variable_direction = "full"
  )

extract_expression_data(x)
extract_expression_data(y)
extract_expression_data(z1)
extract_expression_data(z2)

######combine pos and neg
x = object[1:3, 5:7]
y = object[4:6, 6:8]

z3 =
  merge_mass_dataset(
    x = x,
    y = y,
    sample_direction = "full",
    variable_direction = "full"
  )

extract_expression_data(z3)

tidymass/massdataset documentation built on Oct. 17, 2022, 7:25 a.m.