# NOT RUN {
{
# Set temporary working directory
setwd(tempdir())
data(list = c("Phae.long1", "Phae.long2", "Phae.long3", "Phae.long4", "selec.table"))
writeWave(Phae.long1,"Phae.long1.wav")
writeWave(Phae.long2,"Phae.long2.wav")
writeWave(Phae.long3,"Phae.long3.wav")
writeWave(Phae.long4,"Phae.long4.wav")
compare.methods(X = selec.table, flim = c(0, 10), bp = c(0, 10), mar = 0.1, wl = 300,
ovlp = 90, res = 200, n = 10, length.out = 30,
methods = c("XCORR", "dfDTW"), parallel = 1, it = "jpeg")
#remove progress bar
compare.methods(X = selec.table, flim = c(0, 10), bp = c(0, 10), mar = 0.1, wl = 300,
ovlp = 90, res = 200, n = 10, length.out = 30,
methods = c("XCORR", "dfDTW"), parallel = 1, it = "jpeg", pb = FALSE)
#check this folder!
getwd()
#compare SP and XCORR
#first we need to create a larger data set as the PCA that summarizes the spectral parameters
#needs more units (rows) that variables (columns)
#so I just create a new selection table repeating 3 times selec.table
st2 <- rbind(selec.table, selec.table, selec.table)
#note that the selection labels should be also changed
st2$selec <- 1:nrow(st2)
#now we can compare SP method against XCORR
compare.methods(X = st2, flim = c(0, 10), bp = c(0, 10), mar = 0.1, wl = 300,
ovlp = 90, res = 200, n = 10, length.out = 30,
methods = c("XCORR", "SP"), parallel = 1, it = "jpeg")
#compare SP method against dfDTW
compare.methods(X = st2, flim = c(0, 10), bp = c(0, 10), mar = 0.1, wl = 300,
ovlp = 90, res = 200, n = 10, length.out = 30,
methods = c("dfDTW", "SP"), parallel = 1, it = "jpeg")
#alternatively we can provide our own SP matrix
sp <- specan(selec.table, bp = c(0, 10))
#and selec just a few variables to avoid the problem of # observations vs # parameters in PCA
sp <- sp[, 1:7]
compare.methods(X = selec.table, flim = c(0, 10), sp = sp, bp = c(0, 10), mar = 0.1, wl = 300,
ovlp = 90, res = 200, n = 10, length.out = 30,
methods = c("XCORR", "SP"), parallel = 1, it = "jpeg")
#note that "SP" should also be included as a method in 'methods'
#again, all images are saved in the working directory
}
# }
Run the code above in your browser using DataLab