0

I am working with series data and want to count the number of local 'maxima' and 'minima' (i.e. peaks and troughs/oscillations) along each series. I want to use the 'Peaks' package for this but only get the following error:

WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

Warning in install.packages :
  package ‘Peaks’ is not available for this version of R

A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages

As suggested I installed rtools without any problems but it still returned the same error when I tried installing 'Peaks'. I have not found any information at the cran.r-project link and have also tried to install findpeaks but got the same error. I am not actually sure what version I am running on my desktop (how do you check?); but I have tried it also on Rstudiocloud, which I think is the latest version (4.1.2).I have also tried:

findPeaks(MaxMn, thresh=0)
findValleys(MaxMn, thresh=0)

but R couldn't find the function. I'm a little confused about whether it is a package or function and what I need to do to make it happen. Any suggestions would be greatly appreciated.

Peaks vignette: https://www.rdocumentation.org/packages/splus2R/versions/1.3-3/topics/peaks

zephryl
  • 14,633
  • 3
  • 11
  • 30
Angela Russell
  • 119
  • 1
  • 9

2 Answers2

0

After installing Rtools, you need to put it on the system PATH so that R can find it while trying to build a package from its source code. It's highly likely that in your case Rtools is installed but not on the system path.

You can find the latest details on the process of installing rtools, adding to path and verifying installation is correct from Rtools page (https://cran.r-project.org/bin/windows/Rtools/rtools40.html).

AdroMine
  • 1,427
  • 5
  • 9
0

The package is no longer available on CRAN: "Archived on 2019-04-18 as check problems were not corrected despite reminders."

From googling "R detect peaks", it looks like there are a number of current packages you might be able to use, including pracma and peakPick. In addition to CRAN, this also feels like something the Bioconductor repository may have packages for.

zephryl
  • 14,633
  • 3
  • 11
  • 30