Learn R Programming

warbleR (version 1.1.2)

checksels: Check selection data frames

Description

checksels checks whether selections can be read by subsequent functions.

Usage

checksels(X, parallel =  1, path = NULL)

Arguments

X
data frame with the following columns: 1) "sound.files": name of the .wav files, 2) "sel": 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.
parallel
Numeric. Controls whether parallel computing is applied. It specifies the number of cores to be used. Default is 1 (i.e. no parallel computing). Not available in Windows OS.
path
Character string containing the directory path where the sound files are located. If NULL (default) then the current working directory is used.

Value

If all .wav files are ok, returns message "All files are ok!". Otherwise returns "These file(s) cannot be read" message with names of the corrupted .wav files.

Details

This function checks if the selections listed in the data frame correspond to .wav files in the working directory, if the sound files can be read and if so, if the start and end time of the selections are found within the duration of the sound files. Note that the sound files should be in the working directory (or the directory provided in 'path'). This is useful for avoiding errors in dowstream functions (e.g. specan).

See Also

checkwavs

Examples

Run this code
## Not run: 
# # First set temporary folder
# setwd(tempdir())
# 
# # save wav file examples
# data(list = c("Phae.long1", "Phae.long2", "Phae.long3", "manualoc.df"))
# writeWave(Phae.long1,"Phae.long1.wav")
# writeWave(Phae.long2,"Phae.long2.wav")
# writeWave(Phae.long3,"Phae.long3.wav")
# 
# checksels(X = manualoc.df)
# ## End(Not run)

Run the code above in your browser using DataLab