On 07/06/13 23:05, Duncan Murdoch wrote:
> On 13-06-06 6:22 PM, Rolf Turner wrote:
>> On 07/06/13 03:19, Scott Raynaud wrote:
>>> I actually had tried placing arguments in the call but it didn't 
>>> work.   However, I did
>>> not think about writing it to a variable and printing.  That seems 
>>> to have done the
>>> trick.  Funny, I don't remember having to do that before, but that's 
>>> not surprising.
>>>
>>
>> If I remember correctly --- haven't used Splus for decades --- this is a
>> difference
>> between Splus and R.
>>
>> In R the output of a function is returned *invisibly* if that function
>> is called
>> from within another function.  And source() is one such other function.
>
> Actually this depends on the caller.  source() does return its results 
> invisibly, but many other functions don't.

 From FAQ 7.16:
> If you type '1+1' or 'summary(glm(y~x+z, family=binomial))' at the 
> command line the returned value is automatically printed (unless it is 
> |invisible()|), but in other circumstances, such as in a |source()|d 
> file or ***inside a function*** it isn't printed unless you 
> specifically print it. 

(Emphasis added.)

I think that you have misinterpreted what I wrote.  Many (most?) functions
*return* their results (values) visibly.  But if you put an expression 
into the code
of that function (an expression which is not part of the returned value) 
you never
see the result of evaluating that expression.

E.g.:

     foo <- function(x) {
         sin(42)
         x^2
     }

     foo(3)
     [1] 9

The value of sin(42) is never seen.

The main point however is that IIRC Splus is different from R in respect
of whether the values of (un-assigned) expressions inside source are
visible.  In R they are invisible; in Splus I *believe* (vaguely recall) 
that
they are visible.  I cannot check this since I have no access to Splus.

I do wish someone would confirm (or deny, as the case may be) that
my recollections about Splus are correct.

     cheers,

         Rolf



        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to