Learn R Programming

warbleR (version 1.1.4)

filtersels: Subset selection data frames based on manually filtered image files

Description

filtersels subsets selection data frames based on image files that have been manually filtered.

Usage

filtersels(X, path = NULL, lspec = FALSE, pdf = FALSE)

Arguments

X
data frame with the following columns: 1) "sound.files": name of the .wav files, 2) "sel": number of the selections. The ouptut of manualoc or autodetec can be used as the input data frame.
path
Character string containing the directory path where the sound files are located. If NULL (default) then the current working directory is used.
lspec
A logical argument indicating if the image files to be use for filtering were produced by the function lspec. All the image files that correspond to a sound file must be deleted in order to be filtered out.
pdf
A logical argument indicating if the image files are in .pdf format. Default is FALSE. Note that pdf files can only be generated using lspec2pdf (so they are long spectrograms). Then, if TRUE, lspec argument is ignored.

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 subsets selections (or sound files if lspec is TRUE) listed in a data frame based on the image files from spectrogram-creating functions (e.g. specreator) in the working directory. Only the selections/sound files with and image in the working directory will remain. This is useful for excluding selections from undesired signals. Note that the image files should be in the working directory (or the directory provided in 'path').

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")
# 
# specreator(manualoc.df, flim = c(0, 11), inner.mar = c(4,4.5,2,1), outer.mar = c(4,2,2,1), 
# picsize = 2, res = 300, cexlab = 2, mar = 0.05, wl = 300)
# 
# #go to the working directory and delete some images
# 
# #filter selection data frame
# 
# #this data frame does not have the selections corresponding to the images that were deleted
# fmloc
# 
# #now using lspec images
# lspec(sxrow = 2, rows = 8, pal = reverse.heat.colors, wl = 300, ovlp = 10)
# 
# #go to the working directory and delete lspec images (the ones with several rows of spectrograms)
# 
# #filter selection data frame
# 
# ## End(Not run)

Run the code above in your browser using DataLab