Skip to content

Conversation

@sanroman-24
Copy link

Description

This PR fixes a logical condition used to check whether indices contains only NA values.
Previously, the code used if (is.na(indices)), which only works correctly when indices is a scalar. When indices is a vector, is.na(indices) returns a logical vector, causing a warning or an error (the condition has length > 1).

The updated condition if (all(is.na(indices))) correctly detects when all elements of indices are NA, preventing unexpected behavior when indices is a vector.

Changes

  • Replaced if (is.na(indices)) with if (all(is.na(indices))) to handle vector inputs safely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant