[R] R as a programming language

Duncan Murdoch murdoch at stats.uwo.ca
Thu Nov 8 19:35:34 CET 2007


On 11/8/2007 1:26 PM, Barry Rowlingson 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

Nothing wrong when using cat(), but we sometimes need to compute strings 
when we aren't using cat().

>   and there's always sprintf() for those moments when you want neat 
> formatting.

That's good when you want good control over the formatting, but it 
doesn't tend to be all that readable, with the variables all listed at 
the end, instead of in between the bits of string.
> 
>   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?

Maybe.

Duncan



More information about the R-help mailing list