Re: [R] Retrievable results in a procedure

2018-12-25 Thread Steven Yen
Thanks Sarah. Below, replacing "structure" with "invisible" does wonders--that serves my need. What I want is quite simple - I call a procedure and it does two things: (1) display results for all; (2) save retrievable results for use in further analysis, e.g., in knitr. Earlier, with "structure

Re: [R] Retrievable results in a procedure

2018-12-25 Thread Jeff Newmiller
You can use `capture.output`, but a far, far better solution is to remove the output statements from your computation functions entirely and let the caller decide whether to print the results. You can, for example, add a `debug` parameter to the function, and if true it can return a list of as

Re: [R] Retrievable results in a procedure

2018-12-25 Thread Sarah Goslee
I'm a bit confused about what you actually want, but I think invisible() might be the answer. Note that there's already a base function try() so that's not a great name for test functions. Sarah On Tue, Dec 25, 2018 at 8:47 AM Steven Yen wrote: > I would like to suppressed printing of retrieva

[R] Retrievable results in a procedure

2018-12-25 Thread Steven Yen
I would like to suppressed printing of retrievable results in a procedure and to print only when retrieved. In line 10 below I call procedure "try" and get matrices A,B,C all printed upon a call to the procedure. I get around this unwanted printing by calling with v<-try(A,B) as in line 11. An