[R] Writing R demo files

Olivia Lau olau at fas.harvard.edu
Tue Jun 24 05:34:09 CEST 2003


Hi,

Is it possible to comment demo() files?  I am trying to write
demos that have comments, R commands, and R output so that new
users will be able to follow along.

I have tried readline(), but that returns the readline("...")
command statement as well as the output from readline, and the
demos are ugly.  I have also tried:

options(echo = FALSE)
print("my comments here")
options(echo = TRUE)

[some R commands here]

options(echo = FALSE)
print("more comments")
options(echo = TRUE)

but options() seems to work only at the beginning of the file.
Is there a special command or procedure that I should use?

Thanks,

Olivia Lau




More information about the R-help mailing list