Re: [Rd] Feature request: non-dropping regmatches/strextract

2019-08-29 Thread Michael Lawrence via R-devel
Just started thinking about this. The name of regmatches() suggests that it will only extract the matches but not return anything for the non-matches. We might need another function that returns a value for non-matches. Perhaps the value should be the empty string for non-matches and NA for matches

Re: [Rd] Feature request: non-dropping regmatches/strextract

2019-08-29 Thread Cyclic Group Z_1 via R-devel
Thank you! I greatly appreciate your consideration, though of course it is up to you. I think many people switch to stringr/stringi simply because functions in those packages have some consistent design choices, for example, they do not drop empty/missing matches, which facilitates array-based p

Re: [Rd] Feature request: non-dropping regmatches/strextract

2019-08-29 Thread Michael Lawrence via R-devel
I'd be happy to entertain patches or at least more specific suggestions to improve strextract() and strcapture(). I hadn't exported strextract(), because I wasn't quite sure how it should behave. This feedback should be helpful. Thanks, Michael On Thu, Aug 29, 2019 at 2:20 PM Cyclic Group Z_1 via

Re: [Rd] Feature request: non-dropping regmatches/strextract

2019-08-29 Thread Cyclic Group Z_1 via R-devel
Thank you, I am aware that there are packages that can accomplish this. I mentioned stringr::str_extract as a function that does not drop empty matches. I think that the behavior of regmatches(..., regexpr(...)) in base R should permit an option to prevent dropping of empty matches both for sake

Re: [Rd] Feature request: non-dropping regmatches/strextract

2019-08-29 Thread Toby Hocking
if you want "to extract regex matches into a new column in a data.frame" then there are some package functions which do exactly that. three examples are namedCapture::df_match_variable, rematch2::bind_re_match, and tidyr::extract. For a more detailed discussion see my R journal submission (under re

[Rd] ?Syntax wrong about `?`'s precedence ?

2019-08-29 Thread Ant F
Dear all, `?Syntax` documents that `?` has the lowest precedence, right under `=`. Indeed it reads: *The following unary and binary operators are defined. They are listed in precedence groups, from highest to lowest. * and ends the list with *<- <<-* *assignment (right to left)* *=* *assignme