-
Notifications
You must be signed in to change notification settings - Fork 5
Description
I have been using the wave_to_nvspl.R wrapper for PAMGuide to convert Song Meter Mini audio to NVSPL files. Despite initial success, every subsequent attempt has resulted in an error on line 451:
NSNSDAcoustics/R/wave_to_nvspl.R
Line 451 in a80cbbe
| dataToWrite <- matrix(unqHrData[[hr]],ncol=dim(tempOutput)[2])[,-1] |
Error in `colnames<-`(`*tmp*`, value = NVSPLhead) : attempt to set 'colnames' on an object with less than two dimensions
I can confirm that the object tempOutput has two dimensions, a longer time dimension and a shorter dimension for the fields of the table. In my case, dataToWrite is one-dimensional, thus the error. I have found what appears to be a working solution by breaking line 451 into two lines, as:
dataToWrite <- matrix(unqHrData[[hr]],ncol=dim(tempOutput)[2])
dataToWrite <- dataToWrite[,-1, drop = FALSE]
The drop = FALSE parameter ensures that the dimensionality is preserved. I would like to test this further (especially with a different source of audio) and if it is a universal solution, I intend to write a PR to close this issue if that is acceptable. Thank you!