fix: handle NA values in separate_longer_position() (#1625) - #1634
Closed
LeonidasZhak wants to merge 1 commit into
Closed
fix: handle NA values in separate_longer_position() (#1625)#1634LeonidasZhak wants to merge 1 commit into
LeonidasZhak wants to merge 1 commit into
Conversation
str_split_length() previously errored on NA input because max(str_length(x)) returns NA when x contains NAs. Now NAs are handled separately: non-NA values are split normally, and NA inputs produce single NA_character_ outputs, consistent with separate_longer_delim(). Also adds 3 tests covering NA, all-NA, and NA+keep_empty scenarios.
LeonidasZhak
force-pushed
the
fix/separate-longer-position-na-handling-1625
branch
from
June 7, 2026 11:08
5ea8a1b to
acd4c07
Compare
Member
|
Assuming this is the same as tidymodels/broom#1281 (comment) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
separate_longer_position()errors when input contains NA values, whileseparate_longer_delim()handles them correctly by preserving NA rows in the output.Fix
Modified
str_split_length()inR/separate-longer.Rto handle NA values:NA_character_valuesTests
Added two new tests in
tests/testthat/test-separate-longer.R:separate_longer_position() handles NA values (#1625): Tests mixed NA/non-NA inputseparate_longer_position() handles all-NA input: Tests all-NA inputValidation
separate_longer_delim()Fixes #1625