Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for str_subset & str_detect imply pattern can be empty, but that gives an error #508

Closed
yadbor opened this issue Apr 25, 2023 · 1 comment · Fixed by #563
Closed
Labels
documentation tidy-dev-day 🤓 Tidyverse Developer Day rstd.io/tidy-dev-day

Comments

@yadbor
Copy link

yadbor commented Apr 25, 2023

The documentation for str_detect and str_subset should be updated to say that pattern cannot be empty or boundary().

Currently both say "An empty pattern, "", is equivalent to boundary("character")", implying that they will accept a boundary() as the pattern, but this gives an error as below.

> fruit <- c("apple", "banana", "pear", "pineapple")
> str_subset(fruit, "")
Error in `str_subset()`:
! `pattern` can't be the empty string (`""`).

> fruit <- c("apple", "banana", "pear", "pineapple")
> str_subset(fruit, boundary("character"))
Error in `str_subset()`:
! `pattern` can't be a boundary.
@hadley
Copy link
Member

hadley commented Jul 15, 2024

To fix this documentation issue for TDD, you'll need to identify the five functions that forbit both empty and boundary patterns and create a new @param pattern docstring for them to inherit from instead of str_detect().

@hadley hadley added the tidy-dev-day 🤓 Tidyverse Developer Day rstd.io/tidy-dev-day label Jul 15, 2024
wright13 added a commit to wright13/stringr that referenced this issue Aug 15, 2024
hadley pushed a commit that referenced this issue Aug 20, 2024
Fixes #508

Co-authored by: @RobLBaker
Co-authored-by: Hadley Wickham <h.wickham@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation tidy-dev-day 🤓 Tidyverse Developer Day rstd.io/tidy-dev-day
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants