After reading (most of) "The Scientists and Engineers Guide to Digital Signal Processing" by Steven W. Smith, PhD, I decided to take a second crack at the ECG data. I wrote a set of R functions that implement a windowed (Blackman) sinc low-pass filter. The convolution of filter kernel with the input signal is conducted in the frequency domain using the fast Fourier transform, which is much of the focus of Smith's book.You can check out the complete R script. Also, you can reproduce the analysis and the image below in R by running the following command
The low-pass filter was first applied to eliminate the high frequency noise, anything greater than 30Hz. I next applied the filter at a cutoff frequency of 1Hz in order to isolate the slow wave that corresponds to respirations. The image below gives the sequence of filtering.