[Rd] string concatenation operator (revisited)
gr@ntmcd @end|ng |rom uoregon@edu
Sat Dec 4 23:36:44 CET 2021
I wonder if the R Core team might reconsider an old feature request, as detailed in this 2005 thread: https://stat.ethz.ch/pipermail/r-help/2005-February/thread.html#66698
The TL;DR version is base R support for a `+.character` method. This would essentially provide a shortcut to `paste0`, in much the same way that `\(x)` now provides a shortcut to `function(x)`.
> a = "hello "; b = "world"
> a + b
>  "hello world"
I appreciate some of the original concerns raised against a native "string1 + string2" implementation. The above thread also provides several use-at-your-own-risk workarounds. But sixteen years is a long time in software development and R now stands as something of an exception on this score. Python, Julia, Stata, and SQL (among various others) all support native string concatenation/interpolation using binary/arithmetic operators. It's been a surprising source of frustration for students in some of the classes I teach, particularly those coming from another language.
Many thanks for considering.
PS. I hope I didn't miss any additional discussion of this issue beyond the original 2005 thread. My search efforts didn't turn anything else up, except this popular Stackoverflow question: https://stackoverflow.com/questions/4730551/making-a-string-concatenation-operator-in-r
Department of Economics
University of Oregon
[[alternative HTML version deleted]]
More information about the R-devel