Hi,

I would like to know how to capture the console output from running an algorithm for further analysis.  I can capture this using capture.output() but that yields a character vector.  I would like to extract the actual numeric values.  Here is an example of what I am trying to do.

fr <- function(x) {   ## Rosenbrock Banana function
    on.exit(print(f))
    x1 <- x[1]
    x2 <- x[2]
    f <- 100 * (x2 - x1 * x1)^2 + (1 - x1)^2
    f
}

fvals <- capture.output(ans <- optim(c(-1.2,1), fr))

Now, `fvals' contains character elements, but I would like to obtain the actual numerical values.  How can I do this?

Thanks very much for any suggestions.

Best,
Ravi.

-------------------------------------------------------
Ravi Varadhan, Ph.D.
Assistant Professor,
Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University

Ph. (410) 502-2619
email: rvaradhan@jhmi.edu<mailto:rvaradhan@jhmi.edu>


	[[alternative HTML version deleted]]

