cat("this is a comment that may survive 'source'\n")
?? hope this helps. spencer graves
Martin Maechler wrote:
"Olivia" == Olivia Lau <[EMAIL PROTECTED]>
on Sun, 26 Oct 2003 00:49:45 -0400 writes:
Olivia> Hi, Is there a way to make demo() print comments Olivia> along with the code and output?
not so easily. The same applies to example(.). Both demo(.) and example(.) end up calling source(.) which itself relies on 1) parse(...) 2) eval(...)
parse(.) in R (currently) drops all comments, so they are "lost" very early in source() and hence everything else that calls source().
Many have wanted a version of source() {and hence demo() and example() and ....} that would be able to echo all comments; but this is not really easy: Somehow you need a version of parse() {think of multiline statements!} to do this properly.
Olivia> For example, if I use something like Olivia> readline("..."), demo prints both readline("...") Olivia> and ...; as far as I can tell, this is also true of Olivia> print() and cat(). I just want students to stop and Olivia> think about every command in my demo scripts.
One way, not using demo() would be to ask them to read the R script (e.g. in winedt or emacs) and *send* the commands to a running R themselves.
But's that's a quite different approach {than demo()}. Martin
Martin Maechler <[EMAIL PROTECTED]> http://stat.ethz.ch/~maechler/ Seminar fuer Statistik, ETH-Zentrum LEO C16 Leonhardstr. 27 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-1-632-3408 fax: ...-1228 <><
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
