How it works...

In Step 1, we do some library loading and add a data loading step. As we mentioned previously, with MSnID, this is a little unusual. Instead of just calling a file reading function, we must first create and empty the MSnID object and load the data into it. We create msnid with the MSnID() function and then pass it to the read_mzid() function to actually put data into it. Next, we use the as() function to convert msnid into a data.table object—a data frame-like object that is optimized for large datasets.

In Step 2, we prepare a plot using the tidyverse packages, dplyr and ggplot. tidyverse packages all work really well in concert as they're centered on working with data frames. The usual way of working is to use the piping ...

Get R Bioinformatics Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.