Is it possible to get R to output the value of an expression, that is being 
calculated within a function?  I've attached a very simple example but for more 
complicated ones would like to be able to debug by seeing what the value of 
specific expressions are each time it cycles through a loop that executes the 
expression.  I'm relatively new to this so there may be much simpler more 
elegant ways to do it.

For example, is there a command I can put within the function "funct01" that 
will output the value of z1 to the screen?

Thanks

Jim

==================================
## Practice file to try out evaluations

y <- 5

(x <- y^2)

funct01 <- function (x,y) {

    z1 <- x + y
    z2 <- x * y
    z3 <- x^y

    results <- data.frame (z1=z1, z2=z2, z3=z3)
    return(results)

}

funct01(7,9)


===============================
Dr. Jim Maas
University of East Anglia
Norwich, UK
NR4 7TJ

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to