Learn R Programming

warbleR (version 1.1.9)

ovlp_sels: Find overlapping selections

Description

ovlp_sels finds which selections overlap in time within a given sound file.

Usage

ovlp_sels(X, index = FALSE, pb = TRUE, max.ovlp = 0, relabel = FALSE, 
drop = FALSE, priority = NULL, priority.col = NULL)

Arguments

X

'selection.table' object or data frame with the following columns: 1) "sound.files": name of the .wav files, 2) "selec": number of the selections, 3) "start": start time of selections, 4) "end": end time of selections. The ouptut of manualoc or autodetec can be used as the input data frame. Other data frames can be used as input, but must have at least the 4 columns mentioned above.

index

Logical. Indicates if only the index of the overlapping selections would be returned. Default is FALSE.

pb

Logical argument to control progress bar and messages. Default is TRUE.

max.ovlp

Numeric vector of length 1 specifying the maximum overlap allowed (in seconds) . Default is 0.

relabel

Logical. If TRUE then selections names (selec column) are reset. Default is FALSE.

drop

Logical. If TRUE, when 2 or more selections overlap the function will remove all but one of the overlapping selection. Default is FALSE.

priority

Character vector. Controls the priority criteria used for removing overlapped selections. It must list the levels of the column used to determine priority (argument priority.col) in the desired priority order. Default is NULL.

priority.col

Character vector of length with the name of the column use to determine the priority of overlapped selections. Default is NULL.

Value

A data frame with the columns in X plus an additional column ('ovlp_sels') indicating which selections overlap. The ones with the same number overlap with each other. If drop = TRUE only the non-overlapping selections are return. If 2 or more selections overlap only the first is kept.

Details

This function detects selections within a selection table that overlap in time. Selections must be listed in a data frame similar to selec.table.

See Also

filtersels selec.table

Examples

Run this code
# NOT RUN {
{
#no overlap
ovlp_sels(X =  selec.table)

# modified selec.table to make the first and second selection overlap
Y <- selec.table
Y$end[4] <- 1.5
  
 ovlp_sels(X =  Y)

# drop overlapping
 ovlp_sels(X =  Y, drop = TRUE)

# get index instead
 ovlp_sels(X =  Y, index = TRUE)
}
# }

Run the code above in your browser using DataLab