[R] R as a programming language

(Ted Harding) Ted.Harding at manchester.ac.uk
Thu Nov 8 20:24:13 CET 2007


On 08-Nov-07 18:39:57, Gabor Grothendieck wrote:
> On Nov 8, 2007 1:26 PM, Barry Rowlingson <b.rowlingson at lancaster.ac.uk>
> wrote:
>> hadley wickham wrote:
>>
>> > You're assuming an automatic cast from numbers into strings?  What
>> > if
>> > a + "4" threw an error?
>>
>>  What's wrong with commas anyway when using cat():
>>
>>  > cat("x is ",x,' and y is ',y,'\n',sep='')
>>  x is 1 and y is 2
>>
>>  and there's always sprintf() for those moments when you want neat
>> formatting.
>>
>>  Is it just me who thinks it's odd that in a language that is umpteen
>> years old we are still discussing the fundamentals of what essentially
>> makes up the 'hello world' example?
> 
> The gsubfn package lets you do quasi-perl style
> interpolation on the arguments of a function by
> prefacing the function with fn$ like this:
> 
> library(gsubfn)
> fn$cat("pi = $pi, e = `exp(1)`\n")

Not sure if it's been mentioned already in this thread, but
could there be a case for using unix-shell-like "backquotes",
as in

"pi = `pi`, e = `exp(1)`"

??

(though this might break something else, and would probably
need to be wrapped in a special 'interpreter' function anyway;
I'm out of my depth here!).

Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 08-Nov-07                                       Time: 19:24:09
------------------------------ XFMail ------------------------------



More information about the R-help mailing list