We've been attempting to perform Leave one out Cross Validation to tune parameters and have had some issues getting the predict.HMSC function to accept only a single row of data for X and Y. It appears that the main issue that cannot be fixed by altering the settings or the way the initial data are formatted is an error at line 126:
dimnames(res)[[1]]<-rownames(data$Y)
With only a single row in Y this line returns the error:
Error in dimnames(res)[[1]] <- rownames(data$Y) : 'dimnames' must be a list
I was able to circumvent this issue with the following slight change:
dimnames(res)[[1]]<-list(rownames(data$Y))
Assuming that this does not mess with anything else this change in the package could ease use for those attempting LOO-CV with HMSC.
Hello,
We've been attempting to perform Leave one out Cross Validation to tune parameters and have had some issues getting the
predict.HMSC
function to accept only a single row of data for X and Y. It appears that the main issue that cannot be fixed by altering the settings or the way the initial data are formatted is an error at line 126:dimnames(res)[[1]]<-rownames(data$Y)
With only a single row in Y this line returns the error:
I was able to circumvent this issue with the following slight change:
dimnames(res)[[1]]<-list(rownames(data$Y))
Assuming that this does not mess with anything else this change in the package could ease use for those attempting LOO-CV with HMSC.
Thanks so much for all your work, Robbie