48 lines
1.3 KiB
R
48 lines
1.3 KiB
R
library(warbleR)
|
|
library(Rraven)
|
|
|
|
# For this example, set your working directory to an empty temporary directory
|
|
setwd(tempdir())
|
|
|
|
# Create a new directory and set your working directory
|
|
dir.create(file.path(getwd(), "warbleR_example"))
|
|
setwd(file.path(getwd(), "warbleR_example"))
|
|
|
|
# Check your location
|
|
getwd()
|
|
|
|
# Load Raven example selection tables
|
|
data("selection_files")
|
|
|
|
# Write out Raven example selection tables as physical files
|
|
out <- lapply(1:2, function(x) {
|
|
writeLines(selection_files[[x]], con = names(selection_files)[x])
|
|
})
|
|
|
|
# Write example sound files out as physical .wav files
|
|
data(list = c("Phae.long1", "Phae.long2"))
|
|
|
|
writeWave(Phae.long1, "Phae.long1.wav")
|
|
writeWave(Phae.long2, "Phae.long2.wav")
|
|
|
|
# Import selections
|
|
sels <- imp_raven(all.data = FALSE, freq.cols = FALSE, warbler.format = TRUE)
|
|
str(sels)
|
|
|
|
# Write out the imported selections as a .csv for later use
|
|
write.csv(sels, "Raven_sels.csv", row.names = FALSE)
|
|
|
|
# Create a spectrogram
|
|
wavs <- list.files(pattern = "wav$")
|
|
|
|
# print duration
|
|
duration_wavs(wavs)
|
|
|
|
# draw spectrogram
|
|
# flim: frequency limit in kHz
|
|
# sxrow: seconds of spectrogram per row
|
|
full_spectrograms(flim = c(2, 10), ovlp = 10, sxrow = 3, rows = 1, it = "jpeg", flist = wavs)
|
|
|
|
# concatenate full_sprectrograms file into single PDF per recording
|
|
full_spectrogram2pdf(keep.img = FALSE, overwrite = TRUE)
|