CoordinateCleaner icon indicating copy to clipboard operation
CoordinateCleaner copied to clipboard

Problem using cd_round() with valid and non valid data sets

Open LivioBaetscher opened this issue 2 years ago • 0 comments

Hi,

I run into an issue working with the cd_round() it throws “rbind” error.

I spent some time looking at the problem. I think it comes from the return of “invalid data sets” e.g., if the data set has less then 4 observations. In such a case a df with 5 columns is produced. If the data set is valid, I get 10 columns. I guess this is where the “rbind” Problem comes from.

I was able to avoid the problem by replacing all the output with a length of 5 with an output with the length of 10:

if (length(out_round) == 5) {
out_round <- data.frame(dataset = speciesNames[i], lon.n.outliers = NA, lon.n.regular.distance = NA,
lon.regular.distance = NA, lon.flag = NA, lat.n.outliers = NA, 
lat.n.regular.distance = NA, lat.regular.distance = NA, lat.flag = NA, 
summary = NA)
}

I hope that this helps to improve this very nice R package.

Best Wishes, Livio

LivioBaetscher avatar Feb 01 '22 11:02 LivioBaetscher