find index position of the nearest spectra (band) in the dataset. Match for the lowest difference between integer band and actual SpatRaster band. This will produce duplicates with multiple bands. Drop.
See also
Other Utilities:
change_output_dir()
,
pixel_to_distance()
,
roi_to_vect()
,
spectra_sub()