Re: [Rd] Underscores in package names

2019-08-15 Thread Abby Spurdle
> While > package names are not functions, using dots in package names > encourages the use of dots in functions, a dangerous practice. "dangerous"...? I can't understand the necessity of RStudio and Tiny-Verse affiliated persons to repeatedly use subjective and unscientific phrasing. Elegant, Ad

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

2019-08-15 Thread William Dunlap via R-devel
Using a non-capturing group, "(?:...)" instead of "(...)", simplifies my example a bit > x <- c("Groucho ", "", "Harpo") > strcapture("([[:alpha:]]+)?(?: *<([[:alpha:]. ]+@[[:alpha:]. ]+)>)?", x, proto=data.frame(Name=character(), Address=character(), stringsAsFactors=FALSE)) Name Ad

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

2019-08-15 Thread William Dunlap via R-devel
I don't care much for regmatches and haven't tried strextract, but I think replacing the character(0) by NA_character_ is almost always inappropriate if the match information comes from gregexpr. I think strcapture() does a pretty good job of what I think you are trying to do. Perhaps adding an a

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

2019-08-15 Thread Cyclic Group Z_1 via R-devel
I do think keeping the default behavior is desirable for backwards compatibility; my suggestion is not to change default behavior but to add an optional argument that allows a different behavior. Although this can be implemented in a user-defined function, retaining empty matches facilitates pr

[Rd] Rf_defineVar(symbol, R_UnboundValue, environment) questions

2019-08-15 Thread William Dunlap via R-devel
While poking around the C++ code in the dplyr package I ran across the idiom Rf_defineVar(symbol, R_UnboundValue, environment) to [sort of] remove 'symbol' from 'environment' Using it makes the R-level functions objects(), exists(), and get() somewhat inconsistent and I was wondering if that wa

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

2019-08-15 Thread William Dunlap via R-devel
Changing the default behavior of regmatches would break its use with gregexpr, where the number of matches per input element faries, so a zero-length character vector makes more sense than NA_character_. > x <- c("John Doe", "e e cummings", "Juan de la Madrid") > m <- gregexpr("[A-Z]", x) > regmat

Re: [Rd] Underscores in package names

2019-08-15 Thread Jim Hester
Martin, Thank you for discussing this amongst R-core and for detailing the R-core discussion here. Some specific examples where having underscores available would have been useful. 1. My primerTree package (2013) was originally primer_tree, but I had to change the name to camelCase to comply wit

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

2019-08-15 Thread Cyclic Group Z_1 via R-devel
A very common use case for regmatches is to extract regex matches into a new column in a data.frame (or data.table, etc.) or otherwise use the extracted strings alongside the input. However, the default behavior is to drop empty matches, which results in mismatches in column length if reassignme