Learn R Programming

warbleR (version 1.1.8)

imp.raven: Import Raven selections

Description

imp.raven imports Raven selection data from many files simultaneously. Files must be in .txt format.

Usage

imp.raven(path = NULL, sound.file.col = NULL, all.data = FALSE, recursive = FALSE,
 name.from.file = FALSE, ext.case = NULL, freq.cols = TRUE)

Arguments

path

A character string indicating the path of the directory in which to look for the text files. If not provided (default) the function searches into the current working directory. Default is NULL).

sound.file.col

A character string with the name of the column listing the sound files in the selection text files. Default is NULL). If provided, the output data frame will contained all columns needed for subsequent analysis in warbleR. Duplicated rows, as when "waveform" and "spectrogram" information are included for the same selection, will be removed. All selection files must contain "Selection", "Begin.Time" and "End.Time" columns.

all.data

Logical. If TRUE) all columns in text files are returned, keeping the name columns as in the raven files (not in "warbleR" format). Default is FALSE). Columns absent in some selection files will be filled with NA's.

recursive

Logical. If TRUE) the listing recurse into sub-directories.

name.from.file

Logical. If TRUE) the sound file names are extracted from the selection text file name. It asssumes that selections files contained the suffix "Table.1.selections.txt" or "selections.txt". Note that by default it will assume that the extension file name is ".wav". This can be control using the argumet 'ext.wav'. Default is FALSE). Ignored if sound.file.col' is provided and/or all.data is TRUE).

ext.case

Character string of length 1 to specify whether sound file extensions are in upper or lower case. This should match the extension of the of the .wav files from which the selection were made. It must be either 'upper' or 'lower'. Only needed when 'name.from.file' is TRUE). Ignored if 'sound.file.col' is provided and/or all.data is TRUE).

freq.cols

Logical. If TRUE) 'Low Freq' and 'High Freq' columns are also imported. Ignored if all.data is TRUE.

Value

A single data frame with information of the selection files. If all.data argument is set to FALSE) the data frame contains the following columns: selec, start, end, and selec.file. If sound.file.col is provided the data frame will also contain a 'sound.files' column. In addition, all rows with duplicated data are removed. This is useful when both spectrogram and waveform views are included in the Raven selection files. If all.data is set to TRUE then all columns in selection files are returned.

Details

The function import raven selection data from many files simultaneously. Files must be in .txt format. Note that selection files including data from mulitple recordings cannot be imported. Make sure that NO OTHER TEXT FILES are found in the working directory, only raven generated selections files.

See Also

imp.syrinx

Examples

Run this code
# NOT RUN {
# First set temporary folder
setwd(tempdir())

data(selection.files)

write.table(selection.files[[1]],file = "100889-Garrulax monileger.selections.txt",
row.names = FALSE, sep= '\t')

write.table(selection.files[[2]],file = "1023-Arremonops rufivirgatus.selections.txt",
row.names = FALSE, sep= '\t')

## MAKE SURE THERE ARE NO OTHER .txt FILES IN THE WORKING DIRECTORY
 #providing the name of the column with the sound file names
rav.dat<-imp.raven(sound.file.col = "End.File", all.data = FALSE)

View(rav.dat)

#getting all the data
rav.dat<-imp.raven(all.data = TRUE)
View(rav.dat)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab