Learn R Programming

scorepeak (version 0.1.2)

detect_localmaxima: detect local maxima in univariate time series data

Description

detect local maxima in univariate time series data

Usage

detect_localmaxima(data, w = 3, boundary = "reflecting")

Arguments

data

a numeric vector. Length of data must be greater than 1.

w

window size. w must be odd and greater than 2 and smaller than double length of data.

boundary

determines how data points in the beginning and end of the time series will be treated. "reflecting", "r": reflecting boundary condition, "periodic", "p": periodic boundary condition, "discard", "d", discarding data points in the beginning and end of the time series. See the vignette "Introduction to scorepeak" for detail.

Value

a logical vector. TRUE indicates local peak. FALSE indicates not local peak.

Examples

Run this code
# NOT RUN {
data("ecgca102")
peaks <- detect_localmaxima(ecgca102)
plot(ecgca102, type = "l")
points(which(peaks), ecgca102[peaks], pch = 1, col = "red")
# }

Run the code above in your browser using DataLab