Skip to content
Prev 263641 / 398502 Next

How to capture console output in a numeric format

Try using dput(f) instead of print(f) and
use eval(parse(text=capture.output(...))).

I would tend to use something like
   OUTPUTS <- list()
   fr <- function(x) {
       on.exit(OUTPUTS[[length(OUTPUTS)+1]] <<- list(x=x,f=f))
       ... compute and return f
   }
so you don't have to use capture.output.
(You can use trace() to automate this sort
of thing.)

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com