pks <- read.csv("./data/processed/non_overlapping_peaks.csv")

pks$file <- gsub(".wav", "", sapply(strsplit(as.character(pks$sound.files), "_00", fixed = TRUE), "[[", 2))

count_l <- lapply(unique(pks$file), function(x){
  
  X <- pks[pks$file == x, ]
  
  return(data.frame(file_ID = x, ch1_file_name = X$sound.files[1], call_count = nrow(X)))
  
})

call_count <- do.call(rbind, count_l)

#order
call_count <- call_count[order(call_count$file_ID), ]

# print dynamic table
datatable(call_count, editable = list(
  target = 'row'
), rownames = FALSE, style = "bootstrap",  filter = 'top', options = list(
  pageLength = 300, autoWidth = TRUE, dom = 'ft'
), autoHideNavigation = TRUE)