[R] Printing upon calling a function

Steven Yen @tyen @end|ng |rom ntu@edu@tw
Mon Nov 30 11:54:57 CET 2020


No. I wrote the function so I am sure no "invisible" command was used. 
Strangely enough, compiling the function isto part of a package, results 
were NOT printed. Yes if I call the function during run, by preceding 
the call with a line that attach the source code:

source("A:/.../R/oprobit.R")

it did print. I do not understand.

On 2020/11/30 下午 06:41, Stefan Evert wrote:
>> On 30 Nov 2020, at 10:41, Steven Yen <styen using ntu.edu.tw> wrote:
>>
>> Thanks. I know, my point was on why I get something printed by simply doing line 1 below and at other occasions had to do line 2.
>>
>> me.probit(obj)
> That means the return value of me.probit() has been marked as invisible, so it won't auto-print.  You have to use an explicit print
>
> 	print(me.probit(obj))
>
> or use your work-around to convince R that you actually meant to print the output.
>
> If you dig through the full code of me.probit(), you'll probably find the function invisible() called somewhere.
>
> Best,
> Stefan



More information about the R-help mailing list