Match values of list of MassSpectrum objects to a Tibble field and import information
11:21 17 Mar 2026

I'm trying to rename samples of a list of MassSpectrum objects created by reading spectra data using maldipckr/MALDIquant and then basically following Strejcek et al 2018 workflow.

The problem is that my MALDI reads have generic sampleName . So I need to import more significant sample names from a tibble to this field in my MassSpectrum object.

Here are some details on both objects:

Tibble containing more metadata

MassSpectrum object list with one onbject detials.

So, what I'm trying (and failing) to do is to match the fullName of the spectra data to

paste(
  format(analysis_metadata$Analysis, format = "%Y_%m_%d"),
  analysis_metadata$Well,
  sep = "."
)

and if it matches, get the corresponding information at analysis_metadata$Sample and transfer it to the sampleName of the matching spectrum.

I tried a lot of things: nested for loops, for loop and %in% and other stuff I don't even remember any more.

So I chose to not put any code here, because it got confused after many different tries. I can't also post real data samples once it is not published yet and belong to a group not just me.

Hope you can help me, even without sample code or data. Which I know is not the ideal post format.

r list tibble maldiquant