I'm trying to do a noise removal by FFT in R. The trouble I'm having is that I get a y-axis shift during the process and I'm not sure what the cause is. I have read up on FFT and used this resource as a guide. See below for the code I have been executing as well as sample graphics of the result. Here is a dropbox link to the csv file. data.csv
data=read.csv('data.csv')
plot(data,type='l')
#FFT filtration function
fft.filter=function(data,threshold){
temp=fft(data)
temp[threshold:length(data)-threshold]=0+0i
temp=Re(fft(temp,inverse=TRUE)/length(temp))
return(temp)
}
data2=data
data2$Signal=fft.filter(data2$Signal,100)
As the images show, the data scaling looks fine, I'm just getting a shift that I don't think I should be. The FFT function is working to remove noise from the series.