Group by everything before a character in a string I have a data frame with three different columns: Wavelength, Sample, and Mean.