ints <- c(12, 8, 12, 7, 4, 9, 15, 16, 11, 8, 3, 2, 3, 9, 12, 14, 13, 8, 3)
mzs <- seq_along(ints)
pidx <- as.integer(1)
MsCoreUtils::refineCentroids(
mzs,
ints,
pidx,
k = 3L,
descending = TRUE,
threshold = .33
)
Error in v[, "left"] : subscript out of bounds
This does not occur if the centroid is on any other position or if more than 1 centroid is defined.
It also does not throw an error if descending = FALSE.