Dear all, I have a question about how to suppress intermediate results in a function on console. For example, I will use summary() in my own function that looks like: myfunction <- function(?) { ? Summary(x) ? } Then myfunction() will print ?x? on console that is intermediate result and doesn?t need showing. Does someone have any idea or any suggestion? Thank you in advance. Lisa -- View this message in context: http://r.789695.n4.nabble.com/Suppress-intermediate-results-on-console-tp3553276p3553276.html Sent from the R help mailing list archive at Nabble.com.
Well, since we have no idea what x is, that is going to be hard to do. Are you calling summary because you want the info on the last iteration of a loop? If so, just put the summary call outside the loop. Otherwise, why are you calling summary if you don't want a summary? Also, the posting guide requests a reproducible example, so please provide one in the future. Jon On Thu, May 26, 2011 at 2:30 PM, Lisa <lisajca at gmail.com> wrote:> Dear all, > > I have a question about how to suppress intermediate results in a function > on console. For example, I will use summary() in my own function that looks > like: > > myfunction <- function(?) > { > ?? > ?Summary(x) > ?? > } > > Then myfunction() will print ?x? on console that is intermediate result and > doesn?t need showing. > > Does someone have any idea or any suggestion? Thank you in advance. > > Lisa > > > -- > View this message in context: http://r.789695.n4.nabble.com/Suppress-intermediate-results-on-console-tp3553276p3553276.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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. >-- ==============================================Jon Daily Technician ==============================================#!/usr/bin/env outside # It's great, trust me.
Thanks for your comments and suggestion. I didn?t show all my own function here because it has many lines. ?x? is the results of another function. I am calling summary because I want to extract some values from the results. -- View this message in context: http://r.789695.n4.nabble.com/Suppress-intermediate-results-on-console-tp3553276p3553405.html Sent from the R help mailing list archive at Nabble.com.
On May 26, 2011, at 3:23 PM, Lisa wrote:> Thanks for your comments and suggestion. I didn?t show all my own > function > here because it has many lines. ?x? is the results of another > function. I am > calling summary because I want to extract some values from the > results.Some of the summary functions use cat() which creates a side-effect that may be difficult to intercept. There is a capture.output function. Untested in the absence of a reproducible example.> > -- > View this message in context: http://r.789695.n4.nabble.com/Suppress-intermediate-results-on-console-tp3553276p3553405.html > Sent from the R help mailing list archive at Nabble.com.-- David Winsemius, MD West Hartford, CT