Loaded in files A3 and D4

library(readxl)
A3ex <- read_excel("/Users/evaqirjazi/Downloads/A3.xls")
D4ex <- read_excel("/Users/evaqirjazi/Downloads/D4.xls")

Column slice and renaming

A3new <- A3ex[,1:2]
D4new <- D4ex[,c(1,2)]
names(A3new) <- c('m_z','int')
names(D4new) <- c('m_z','int')

Filtering by m_z and rounding

A3filtered <- A3new[A3new$int>1000,]
D4filtered <- D4new[D4new$int>10,]
A3filtered$m_z <- round(A3filtered$m_z)
D4filtered$m_z <- round(D4filtered$m_z)

Using merge to keep perfect matches

matchDF <- merge(A3filtered,D4filtered,by="m_z")

Building tidy data

A3tidy <- cbind(sample='Standard',A3filtered)
D4tidy <- cbind(sample='Digest',D4filtered)
Matchtidy <- cbind(sample='Match',
                   matchDF[,c(1,3)])
names(Matchtidy) <- c('sample','m_z','int')
tidyDF <- rbind(A3tidy,
                D4tidy,
                Matchtidy)

Plotting ggplot

#install.packages("ggplot2")
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.4.3
p <- ggplot(tidyDF, aes(x = m_z,y=int))+
  geom_col(aes(colour = sample , fill=sample))+
  xlab("m/z ratio") + ylab("Millivolts")+
  facet_wrap(~sample,nrow=3)
p