R Arrays::maxIndex - wrong functionality for max index