Skip to content
Snippets Groups Projects
Verified Commit d9ed74ba authored by Gärber, Florian's avatar Gärber, Florian
Browse files

fix: `mean.index()` being padded with trailing NA over length(variables)

It was intended to set the index of the variable with itself to be NA.
As written, this would set the index of the variable among all variables in the data set to be NA, thus creating longer vectors when the index of that variable exceeded the length of `variables`.
Fixes bug introduced in https://github.com/StephanSeifert/SurrogateMinimalDepth/commit/4039d104f14f5f0a09f1c97135550564163febd6
parent 2ca81d8f
Branches
Tags
No related merge requests found
......@@ -67,7 +67,7 @@ mean.index <- function(i, list.res, index.variables) {
list <- list.res[which(names(list.res) == index.variables[i])]
mean.list <- round(Reduce("+", list) / length(list), 2)
if (length(mean.list) > 0) {
mean.list[index.variables[i]] <- NA
mean.list[i] <- NA
return(mean.list)
} else {
return(rep(NA, length(index.variables)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment