> On 30 Nov 2020, at 10:41, Steven Yen <styen at 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
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 at 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
On 30/11/2020 5:41 a.m., Stefan Evert wrote:> >> On 30 Nov 2020, at 10:41, Steven Yen <styen at 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. >I think you misread his post. "me.probit(obj)" on its own *did* print. It was when he assigned it to a variable using "v <- me.probit(obj)" that it didn't. Assignments are almost always invisible in R. The other thing that people sometimes find confusing is that evaluating expressions that are visible are the top level doesn't make them print when they are nested in a block of code. Usually this happens in a function, e.g. typing a number normally makes it visible, but f <- function() { 1 2 } f() doesn't print 1, it only prints 2, and that happens because 2 is the return value of the function. Duncan Murdoch