Add R-peak detection algorithm

Add R-peak detection algorithm to computeRRinterval() and other small
changes