On 13/04/2010 8:50 AM, Duncan Murdoch wrote: > On 12/04/2010 7:14 PM, Kuhn, Alexandre (NIH/NIA/IRP) [V] wrote: >> Hi, >> >> source(file,echo=T) will not echo the last comment in "file" if it is the last line in the file. >> For instance, when sourcing a file containing the following lines >> >> #comment 1 >> a<-1 >> #comment 2 >> >> R will echo >> >>> #comment 1 >>> a<-1 >> What is the solution to have R echo all of the comment lines? >> > I think the only current solution is to have all the comment lines ahead > of code lines. R doesn't specifically echo the comments, it only echoes > the code, but comments that happen to precede the end of the code line > are echoed as part of that line. >> Specific context: >> This problem arises e.g. in the context of help files (.Rd) whose example section contains only code that is not to be run (\dontrun markup). Running the function example() (that itself calls source(,echo=TRUE)) on such a file will not display anything (because the code is commented out in the corersponding files in R-ex). Is that the desired behavior of example() or is there a workaround (i.e. to be able write help files with only dontrun code but that will nevertheless echo the examples)? >> >> > I'm not sure we really want to show all the \dontrun examples, but I'll > look into this, because as documented, they should be shown. (My > preference would be to completely hide the \dontrun lines in example(), > but that's not what is documented to happen, and that's not what happens > when they are followed by code.)
I've fixed this now in R-devel (to become 2.12.0 in the fall). It's too late to make it into 2.11.0, but I may put it into R-patched after the release. Duncan Murdoch [[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.