using split_acoustic_data() in package ohun

Viewed 19

one of my first mwes here. I am trying to use a function called split_audio_data() in ohun, a package for processing bioacoustic data. The process involves use of a class of object called a selection table, so I used a subset of a CSV file to build one below.

install.packages("devtools")
devtools::install_github("maRce10/warbleR")

#load package
library(warbleR)

# loading some data from dput to make into a selection table
example <-structure(list(sound.files = c("Floodplain_220814_1205.wav", 
                                         "Floodplain_220814_1205.wav", "Floodplain_220814_1205.wav"), 
                         selec = 1:3, start = c(4877.33, 4880.5, 4881.5), end = c(4878, 
                                                                                  4881.5, 4882)), row.names = c(NA, 3L), class = "data.frame")

# building the selection table itself                                                                                                                                  
exampleselectiontable <- selection_table(example, max.dur = 2, path = NULL, whole.recs = FALSE,
                                 extended = FALSE, confirm.extended = TRUE, mar = 0.1, by.song = NULL, 
                                 pb = TRUE, parallel = 1, verbose = TRUE)

# double and triple checking to make sure it's a selection table:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
is_selection_table(exampleselectiontable)
class(exampleselectiontable)

# install package
remotes::install_github("maRce10/ohun")

#load package
library(ohun)

# trying to split into 30-second segments:
split_acoustic_data(sgmt.dur = 30, X = exampleselectiontable)

The error I'm getting says "Error: both objects must be of class 'selection_table'". What I have there is a selection table, as near as I can tell, and reading the details of split_acoustic_data I haven't found a candidate for what the "other" selection table might need to be.

Would appreciate any thoughts.

0 Answers
Related