# NOT RUN {
{
# get warbleR sound file examples
data(list = c("Phae.long1", "Phae.long2", "Phae.long3", "Phae.long4", "lbh_selec_table"))
writeWave(Phae.long1, file.path(tempdir(), "Phae.long1.wav"))
writeWave(Phae.long2, file.path(tempdir(), "Phae.long2.wav"))
writeWave(Phae.long3, file.path(tempdir(), "Phae.long3.wav"))
# add a 'song' column
lbh_selec_table$song <- c("song1", "song1", "song1", "song2",
"song2", "song3", "song3", "song3", "song4", "song4", "song4")
# measure acoustic parameters
sp <- specan(lbh_selec_table[1:8, ], bp = c(1, 11), 300, fast = TRUE, path = tempdir())
# add song data
sp <- merge(sp, lbh_selec_table[1:8, ], by = c("sound.files", "selec"))
# caculate song-level parameters for all numeric parameters
song_param(X = sp, song_colm = "song", parallel = 1, pb = TRUE)
# caculate song-level parameters selecting parameters with mean_colm
song_param(X = sp, song_colm = "song",mean_colm = c("dfrange", "duration"), parallel = 1, pb = TRUE)
# caculate song-level parameters for selecting parameters with mean_colm, max_colm
# and min_colm and weighted by duration
song_param(X = sp, weight = "duration", song_colm = "song",
mean_colm = c("dfrange", "duration"), min_colm = "mindom", max_colm = "maxdom",
parallel = 1, pb = TRUE)
# with two weights
song_param(X = sp, weight = c("duration", "dfrange"), song_colm = "song",
mean_colm = c("kurt", "sp.ent"), parallel = 1, pb = TRUE)
# with two weights no progress bar
song_param(X = sp, weight = c("duration", "dfrange"), song_colm = "song",
mean_colm = c("kurt", "sp.ent"), parallel = 1, pb = FALSE)
}
# }
Run the code above in your browser using DataLab