Skip to content

wave_to_nvspl.R dimensionality mismatch error #15

@dbetchkal

Description

@dbetchkal

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:

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!

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions