get.peaks: A function to identify peaks within a dataset.

Description Usage Arguments Examples

Description

A subroutine called by functions within the cyphid package. get.peaks is originally from the package msProcess version 1.0.5. The package was archived on 2012-09-21 and is unvailable as a dependency for cyphid. The arichived package and original code can be obtained from http://cran.r-project.org/src/contrib/Archive/msProcess/

Usage

1
get.peaks(x, span = 40)

Arguments

x
span

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (x, span = 40) 
  {
    z <- embed(rev(as.vector(x)), dim = span)
    z <- z[rev(seq(nrow(z))), ]
    s <- span%/%2
    v <- max.col(z, ties.method = "first") == 1 + s
    z <- c(rep(FALSE, s), v)
    ans <- c(z[1:(length(z) - s)], rep(FALSE, span - 1))
    nx <- NCOL(x)
    if (nx > 1) 
      matrix(ans, ncol = nx)
    else ans
  }

cyphid documentation built on May 2, 2019, 2:41 a.m.