Skip to content
Prev 60542 / 63424 Next

strsplit() and final empty values

Here's an example clarifying the issue:
[[1]]
[1] "a" "b" "c" "d"
[[1]]
[1] "a" "b" "c"

I also ran into this a few times, and I agree that this complicated
things when you need to preserve that last empty element.  Instead of
changing the default behavior, which would probably break lots of
existing code relying on it, one could introduce a new,
backward-compatible argument `drop = TRUE`, e.g.
[[1]]
[1] "a" "b" "c" ""

My $.02

/Henrik
On Sat, Feb 26, 2022 at 6:39 AM Dzmitry Batrakou <d.batrakou at gmail.com> wrote: