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
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
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
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
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
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