knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  warning = FALSE,
  message = TRUE,
  out.width = "100%"
)

Some times if you have more than two batch peak tables, and they are processed at different times, so you need to align them together before other analysis. In masscleaner, we use the align_batch() function to do that.

Data preparation

See the massdataset package, and create you metabolomics dataset into 2 mass_dataset objects.

Here we use the demo data from demodata package, so please install it first.

if(!require(devtools)){
install.packages("devtools")
}
devtools::install_github("tidymass/demodata")
library(masscleaner)
library(demodata)
library(tidyverse)

Run align_batch() function

data(object1, package = "demodata")
data(object2, package = "demodata")

object1
object2

x = object1
y = object2

match_result =
  align_batch(x = object1, y = object2, return_index = TRUE)

head(match_result)

new_object =
  align_batch(x = object1, y = object2, return_index = FALSE)

new_object

Session information

sessionInfo()


tidymass/masscleaner documentation built on Sept. 4, 2023, 3:21 a.m.