From ggrothendieck at gmail.com  Sat Jan 22 21:56:15 2011
From: ggrothendieck at gmail.com (Gabor Grothendieck)
Date: Sat, 22 Jan 2011 15:56:15 -0500
Subject: [Rd] "+" operator on characters revisited
In-Reply-To: <878vycd7ld.fsf@gmail.com>
References: <878vycd7ld.fsf@gmail.com>
Message-ID: <AANLkTin_=MtMYZOjprLme53-H4XVOD7y_d9DpH+OiEb_@mail.gmail.com>

On Sat, Jan 22, 2011 at 3:08 PM, Vitalie S. <spinuvit.list at gmail.com> wrote:
>
> Hello everyone!
>
> Motivated by the recent post on SO
> http://stackoverflow.com/questions/4730551/making-a-string-concatenation-operator-in-r
>
> I wonder what is the current state of argument on making "+" to
> concatenate character vectors. The "+" method is still sealed for
> signature("character", "character") in the current version of R.
>
> The 4 years old R-devel thread
> https://www.stat.math.ethz.ch/pipermail/r-devel/2006-August/038991.html
> on the same topic, stopped without reaching any definite conclusion.
>
> The only definite argument occurred in the thread against "+" operator
> was the lack of commutativity (as if one have to prove algebraic
> theorems in R).
>
> Yet another useful suggestion of introducing cat0() and paste0(), for
> the common use of cat and paste with sep="" was not absorbed by the
> core R either.

The gsubfn package has always had a paste0 function and I would be
happy to remove it if the core adds it.

Also the gsubfn supports quasi perl style string interpolation that
can sometimes be used to avoid the use of paste in the first place.
Just preface the function in question by fn$ like this:

library(gsubfn)
fn$cat("pi = $pi\n")

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



[Rd] "+" operator on characters revisited
Gabor Grothendieck