View source: R/rename_est_waves.R
rename_est_waves | R Documentation |
rename_est_waves
rename wave objects and associated metadata in extended selection tables
rename_est_waves(X, new.sound.files, new.selec = NULL)
X |
object of class 'extended_selection_table'. |
new.sound.files |
Character vector of length equals to the number of wave objects in the extended selection table ( |
new.selec |
Numeric or character vector of length equals to the number of rows in 'X' to specify the 'selec' column labels. Default is |
This function allow users to change the names of 'sound.files' and 'selec' columns in extended selection tables. These names can become very long after manipulations used to produce extended tables.
An extended selection table with rename sound files names in data frame and attributes. The function adds columns with the previous sound file names (and 'selec' if provided).
Marcelo Araya-Salas (marcelo.araya@ucr.ac.cr)
Araya-Salas, M., & Smith-Vidaurre, G. (2017). warbleR: An R package to streamline analysis of animal acoustic signals. Methods in Ecology and Evolution, 8(2), 184-191.
Other extended selection table manipulation:
by_element_est()
,
resample_est()
{
data("lbh.est")
# order by sound file name
lbh.est <- lbh.est[order(lbh.est$sound.files),]
# create new sound file name
nsf <- sapply(strsplit(lbh.est$sound.files, ".wav",fixed = TRUE), "[",1)
slc <- vector(length = nrow(lbh.est))
slc[1] <- 1
for(i in 2:length(slc))
if (nsf[i - 1] == nsf[i]) slc[i] <- slc[i - 1] + 1 else
slc[i] <- 1
nsf <- paste(nsf, slc, sep = "_")
# rename sound files
Y <- rename_est_waves(X = lbh.est, new.sound.files = nsf)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.