Implementing a bandpass filter in R - this code's logic confuses me
Without knowing what values are being passed in, I will assume the +2 is an adjustment for R using 1 based indices.
The band in the upper half of the frequency data represent complex frequencies symmetric about the fft length/2. The motivation is using a property of the DFT that will result in a real value output from the ifft: http://en.wikipedia.org/wiki/Discrete_Fourier_transform#The_real-input_DFT