Learn R Programming

Rraven (version 1.0.14)

relabel_colms: Relabel columns to match the selection table format

Description

relabel_colms relabels columns to match the selection table format (as in the R package warbleR)

Usage

relabel_colms(X, extra.cols.name = NULL, extra.cols.new.name = NULL, 
khz.to.hz = FALSE, hz.to.khz = FALSE, waveform = FALSE)

Value

The function returns the input data frame with new column names for time and frequency 'coordinates' and sound files and selections.

Arguments

X

Data frame imported from Raven.

extra.cols.name

Character vector with the names of additional columns to be relabeled. Default is NULL. 'extra.cols.new.name' must also be provided.

extra.cols.new.name

Character vector with the new names for the additional columns to be relabeled. Default is NULL. 'extra.cols.name' must also be provided.

khz.to.hz

Logical. Controls if frequency variables ('top.freq' and 'bottom.freq') should be converted from kHz (the unit used by other bioacoustic analysis R packages like warbleR) to Hz (the unit used by Raven). Default is FALSE.

hz.to.khz

Logical. Controls if frequency variables ('top.freq' and 'bottom.freq') should be converted from Hz (the unit used by other bioacoustic analysis R packages like Raven) to kHz (the unit used by warbleR). Default is FALSE. Ignored if 'kHz.to.hz' is TRUE.

waveform

Logical to control if 'waveform' related data should be included (this data is typically duplicated in 'spectrogram' data). Default is FALSE (not to include it).

Author

Marcelo Araya-Salas (marcelo.araya@ucr.ac.cr)

Details

This function relabels columns to match the selection table format to match then ones used by other bioacoustic analysis R packages like warbleR.

See Also

imp_raven; exp_raven

Examples

Run this code

# Load data
data(selection_files)

#save 'Raven' selection tables in the temporary directory 
writeLines(selection_files[[5]], con = file.path(tempdir(), names(selection_files)[5]))

# \donttest{ 
#'# import data to R
rvn.dat <- imp_raven(all.data = TRUE, path = tempdir()) 

names(rvn.dat)

# Select data for a single sound file
rvn.dat2 <-  relabel_colms(rvn.dat)

names(rvn.dat2)

# plus 1 additional column
rvn.dat2 <-  relabel_colms(rvn.dat, extra.cols.name = "selec.file", "Raven selection file")

names(rvn.dat2)

# plus 2 additional column 
rvn.dat2 <- relabel_colms(rvn.dat, extra.cols.name = c("selec.file", "View"), 
c("Raven selection file", "Raven view"))
 
names(rvn.dat2)
# }

Run the code above in your browser using DataLab