Skip to contents

Merge two mass_dataset objects. More information can be found here https://www.tidymass.org/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

Xiaotao Shen xiaotao.shen@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]

z1 <- merge_mass_dataset(
  x = x,
  y = y,
  sample_direction = "full",
  variable_direction = "full"
)

z2 <- merge_mass_dataset(
  x = x,
  y = y,
  sample_direction = "inner",
  variable_direction = "full"
)

dim(extract_expression_data(z1))
#> [1] 4 4
dim(extract_expression_data(z2))
#> [1] 4 2

z3 <- merge_mass_dataset(
  x = object[1:3, 5:7],
  y = object[4:6, 6:8],
  sample_direction = "full",
  variable_direction = "full"
)
dim(extract_expression_data(z3))
#> [1] 6 4