I did this a few days ago for a colleague exactly the way that you describe.
Replace `xcms_p_POS_g_r_g` with your object.
library(xcms)
library(dplyr)
library(tidyr)
investigate_data <- tibble(rtime = rtime(xcms_p_POS_g_r_g, adjusted = FALSE, bySample = TRUE),
adjustedRtime = rtime(xcms_p_POS_g_r_g, adjusted = TRUE, bySample = TRUE),
file = basename(fileNames(xcms_p_POS_g_r_g))
) %>%
unnest(c(rtime, adjustedRtime)) %>%
mutate(diff = adjustedRtime - rtime)
investigate_data %>%
filter(abs(adjustedRtime-250)<1) %>% # <-- focus on a small RT range where the outlier is clear
group_by(file) %>%
arrange(diff) %>% # <-- use desc if looking for a positive difference
slice(1) %>%
ungroup %>%
arrange(diff) # <-- use desc if looking for a positive difference