/pracma2

A Faster Implementation of Finding Peaks

Primary LanguageR

pracma2

CRAN status

Overview

This is a very simple package which offers a reimplementation of pracma::findpeaks(). pracma::findpeaks() uses character strings and regex to find the peaks whereas pracma2::findpeaks() uses integers, which is faster.

(back to top)

Installation

You can install the package with

# install.packages("remotes")
remotes::install_github("nathaneastwood/pracma2")

(back to top)

Usage

library(pracma2)

x <- c(2, 12, 4, 6, 9, 4, 3, 1, 19, 7)

findpeaks(x)
#      [,1] [,2] [,3] [,4]
# [1,]   12    2    1    3
# [2,]    9    5    3    8
# [3,]   19    9    8   10

findpeaks(x, minpeakheight = 15)
#      [,1] [,2] [,3] [,4]
# [1,]   19    9    8   10

(back to top)

Related Work

(back to top)