Skip to content

Offer an option for type-stability of re_matches() #94

@MichaelChirico

Description

@MichaelChirico

More than once now, we've run into an issue caused by type-instability of re_matches() output (logical vector vs. data.frame).

r-lib/lintr#196
r-lib/lintr#2287
r-lib/lintr#2678

At root, if we're writing functions taking regular expressions with re_matches() as a backend, it's hard to anticipate whether the user will use capture groups (or vice versa), and it can be hard to remember the need to branch the follow-up code depending on whether we received a data.frame.

Much better IMO to offer a path for type-stability directly in the re_matches() API (much like simplify=FALSE in *apply world). Maybe ignore_capture_groups (FALSE by default), then we can write code with ignore_capture_groups=TRUE to guarantee a logical return.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions