peaks: Peak values

Description Usage Arguments Value Author(s) References Examples

Description

Algorithm to find peak values

Usage

1
peaks(series, span = 3, do.pad = TRUE)

Arguments

series

the values to find peaks in

span

a span parameter

do.pad

= TRUE

Value

a logical vector idicating if the point is a peak value or not

Author(s)

R community ???

References

https://stat.ethz.ch/pipermail/r-help/2005-November/083376.html

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
set.seed(7)
y <- rpois(100, lambda = 7)
py <- peaks(y)
plot(y, type="o", cex = 1/4, main = "y and peaks(y,3)")
points(seq(y)[py], y[py], col = 2, cex = 1.5)

p7 <- peaks(y,7)
points(seq(y)[p7], y[p7], col = 3, cex = 2)
mtext("peaks(y,7)", col=3)

set.seed(2)
x <- round(rnorm(500), 2)
y <- cumsum(x)

plot(y, type="o", cex = 1/4)
p15 <- peaks(y,15)
points(seq(y)[p15], y[p15], col = 3, cex = 2)
mtext("peaks(y,15)", col=3)

hansoleorka/myR documentation built on May 17, 2019, 2:29 p.m.