Description Usage Arguments Value Author(s) See Also Examples
View source: R/detect.events.R
steps along a frequency contour and calculates the weighted distance between consecutive instants. if the weighted distance is > 1 then a new event begins
1 | detect.events(X, var.weights)
|
X |
a data frame of frequency contour measurements |
var.weights |
the weights of the variables in X |
a factor of event ids, one for each instant
Benjamin N. Taft ben.taft@landmarkacoustics.com
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ##---- 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, var.weights)
{
events <- rep(1, nrow(X))
for (j in 1:ncol(X)) X[, j] <- X[, j] * var.weights[j]
for (i in 2:nrow(X)) {
events[i] <- events[i - 1]
delta <- sum((X[i, ] - X[i - 1, ])^2)
if (delta > 1)
events[i] <- events[i] + 1
}
return(invisible(events))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.