Here is my experiment:

I am using the `findPeaks` function in the [quantmod](http://cran.r-project.org/web/packages/quantmod/index.html) package:

I want to detect "local" peaks within a tolerance 5, i.e. the first locations after the time series drops from the local peaks by 5:

```
aa=100:1
bb=sin(aa/3)
cc=aa*bb
plot(cc, type="l")
p=findPeaks(cc, 5)
points(p, cc[p])
p

```

The output is

```
[1] 3 22 41

```

It seems wrong, as I am expecting more "local peaks" than 3...

Any thoughts?