From ivo.welch at gmail.com  Wed Aug 21 00:39:10 2013
From: ivo.welch at gmail.com (ivo welch)
Date: Tue, 20 Aug 2013 15:39:10 -0700
Subject: [Rd] Extending suggestion for stopifnot
In-Reply-To: <CAP01uR=DjMtUHE7QZmHuY5hwRADg66dADRX1AxoFmbTJWBwFMw@mail.gmail.com>
References: <CAPr7RtX3b5XBzgn1XT3nPcvX71G=W1CpK=tK1T3zz4zWW=pQNQ@mail.gmail.com>
	<CA+hbrhVcih5+u1hV5c2c_+HC6UJ6BzpdwmP4VWuuU=gdNmkz1Q@mail.gmail.com>
	<13664C4E-7ACE-410E-A0EE-6D07D5E590BD@muxspace.com>
	<CAPr7RtWxF=Vh3OSpZEonKpLKnbDNnHT2X3dvAXVzeqdcnB2_CA@mail.gmail.com>
	<CAP01uR=DjMtUHE7QZmHuY5hwRADg66dADRX1AxoFmbTJWBwFMw@mail.gmail.com>
Message-ID: <CAPr7RtUhENdMa8zgT8-ys9GccjFr+R=fA6XMep5mqkoLfv7SjQ@mail.gmail.com>

functionality is nice.  syntax is weird.  I think I would have
preferred an "interpolate" function call.
    stop( i("class is `class(pi)` and $pi") )
three typing letters, too, and more logical.  most importantly, I wish
we had some form of this in base R from the outset--whatever it is--so
that my students get used to using the standard from the outset.

[the {{...}} had the advantage of being unlikely to break anything.
perl has it nicely done--- " is interpolated, ' is not.  but this is a
bridge that we crossed long ago in R.  it would break too much.]

best,

/iaw
----
Ivo Welch (ivo.welch at gmail.com)
http://www.ivo-welch.info/
J. Fred Weston Professor of Finance
Anderson School at UCLA, C519
Director, UCLA Anderson Fink Center for Finance and Investments
Free Finance Textbook, http://book.ivo-welch.info/
Editor, Critical Finance Review, http://www.critical-finance-review.org/



On Tue, Aug 20, 2013 at 3:28 PM, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
> On Tue, Aug 20, 2013 at 6:00 PM, ivo welch <ivo.welch at gmail.com> wrote:
>> character string at the end of an existing function, stopifnot().  (2)
>> I think "estrings" (that behave like characters but are interpolated
>> before printout) are useful in the same way perl interpolated strings
>> are useful.
>
> The gsubfn package has string interpolation somewhat like perl.
> Preface a function call with fn$ and then back ticks and $ are
> interpolated.
>
> library(gsubfn)
> fn$identity("pi is $pi")
>
> library(sqldf)
> fn$sqldf("select * from BOD where Time > $pi")
>
> fn$stop("class is `class(pi)`")



[Rd] Extending suggestion for stopifnot
ivo welch