calculate.landmarks: aggregates a peak into landmark descriptions of events

Description Usage Arguments Value Author(s) See Also Examples

View source: R/calculate.landmarks.R

Description

given a peak contour, event ids, and landmark ids, aggregates the contour into a data frame that contains landmarks sets for each event

Usage

1
calculate.landmarks(peaks, evs.and.lmrks)

Arguments

peaks

a data frame containing a description of peak contours

evs.and.lmrks

a data frame containing an event factor and a landmark factor

Value

a data frame with a bunch of shiny landmark measurements

Author(s)

Benjamin N. Taft [email protected]

See Also

make.peaks assign.to.landmarks detect.events

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 (peaks, evs.and.lmrks) 
{
    fa <- is.finite(evs.and.lmrks$event)
    landmarks <- aggregate(peaks$time[fa], evs.and.lmrks[fa, 
        ], min)
    names(landmarks)[3] <- "start.time"
    landmarks <- cbind(landmarks, aggregate(peaks[fa, 1:8], evs.and.lmrks[fa, 
        ], mean)[, -(1:2)])
    landmarks$time <- landmarks$time - landmarks$start.time
    landmarks <- landmarks[order(landmarks$event, landmarks$landmark), 
        ]
    return(invisible(landmarks))
  }

landmarkacoustics/SoundPoints-R documentation built on Sept. 26, 2018, 9:08 a.m.