[Rd] Feature request: non-dropping regmatches/strextract
Michael Lawrence
|@wrence@m|ch@e| @end|ng |rom gene@com
Thu Aug 29 23:29:25 CEST 2019
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 R-devel
<r-devel using r-project.org> wrote:
>
> 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 of consistency with the rest of the language (missing data does not yield a dropped index in other sorts of R functions, and an empty match conceptually corresponds with missing data) and facility of use in data.frames. The behavior of regmatches(..., gregexpr(...)) is not objectionable to me, as lists do not drop indices when they contain character(0) vectors. Alternatively, perhaps this should be reflected in the (currently non-exported) strextract.
>
> Best,
> CG
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
--
Michael Lawrence
Scientist, Bioinformatics and Computational Biology
Genentech, A Member of the Roche Group
Office +1 (650) 225-7760
michafla using gene.com
Join Genentech on LinkedIn | Twitter | Facebook | Instagram | YouTube
More information about the R-devel
mailing list