From cyc||cgroup-z1 @end|ng |rom y@hoo@com  Thu Aug 29 23:19:22 2019
From: cyc||cgroup-z1 @end|ng |rom y@hoo@com (Cyclic Group Z_1)
Date: Thu, 29 Aug 2019 21:19:22 +0000 (UTC)
Subject: [Rd] Feature request: non-dropping regmatches/strextract
In-Reply-To: <CALK03d2cCoAboDBmr5dhR9+kjGh5=Eg5QAHmKc-qJYm_iGO5mw@mail.gmail.com>
References: <2012653205.221487.1565848601638.ref@mail.yahoo.com>
 <2012653205.221487.1565848601638@mail.yahoo.com>
 <CALK03d2cCoAboDBmr5dhR9+kjGh5=Eg5QAHmKc-qJYm_iGO5mw@mail.gmail.com>
Message-ID: <102772513.32513.1567113562904@mail.yahoo.com>

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



[Rd] Feature request: non-dropping regmatches/strextract
Cyclic Group Z_1