# NOT RUN {
# finds also the border peak maximum at index 29
x <- c(1:10, 9:1, 2:11)
peak_indices <- find_peaks(x, w=3, get_min=FALSE)
peak_indices
x[peak_indices]
# and the border peak at index 1
peak_indices <- find_peaks(x, w=3, get_min=TRUE)
peak_indices
x[peak_indices]
# what means the neigbohood parameter w:
# at least w-many values need to be inbetween two consecutive peaks
x <- -c(1:10, 9, 9, 11, 9:8, 7)
peak_indices <- find_peaks(x, w=3)
peak_indices
x[peak_indices]
x <- -c(1:10, 9, 9,9, 11, 9:8, 7)
peak_indices <- find_peaks(x, w=3)
peak_indices
x[peak_indices]
# what means the strict parameter:
x <- c(10:1, 1:10)
peak_indices <- find_peaks(x, w=3, strict = TRUE)
peak_indices
x[peak_indices]
peak_indices <- find_peaks(x, w=3, strict = FALSE)
peak_indices
x[peak_indices]
# }
Run the code above in your browser using DataLab