[R] Echoing commands (not using source())

Henrik Bengtsson henrikb at braju.com
Wed Apr 11 05:40:55 CEST 2001


Is there a way of echoing (similar to Matlab "echo on") commands that are
being executed? I know how to do this for script files by using source(...,
echo=TRUE), but I would like to be able to use this within *any* function. I
am also not looking for the debug() function. Here is what I would like to
do:

myFunction <- function() {
  echo(TRUE);
  x <- 3;
  cat("x = ", x, "\n");
  echo(FALSE);
}

Output:
>myFunction()
x <- 3;
cat("x = ", x, "\n");
x = 3
>


Thanks

Henrik Bengtsson

h e n r i k b @ b r a j u . c o m

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list