Re: [R] source(echo=TRUE) bug (was: source() behavior I don't understand)

From: Duncan Murdoch <murdoch_at_stats.uwo.ca>
Date: Sun, 09 Mar 2008 22:52:06 -0400

On 09/03/2008 10:40 PM, Richard M. Heiberger wrote:

> Thanks Duncan,
> 
> While there, can you give a new optional argument that
> will permit the echo of blanks and comments?

Comments are already echoed, leading blank lines are not (but blanks in comments are). For example:

> temp.ttt <- "ttt <- 1\n\n# comment\n\nttt"
> cat(file="c:/temp/temp.R", temp.ttt)
> source("c:/temp/temp.R", echo=TRUE)

> ttt <- 1

> # comment
>
> ttt

[1] 1

(I ran this in the patched version, but I believe the behaviour would be the same in the release as well.)

I forget exactly why I chose to suppress leading blanks, but the workaround of commenting the first of them is so easy, I don't think it's worth the trouble to add an extra option.

Duncan



R-help_at_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. Received on Mon 10 Mar 2008 - 02:54:27 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 10 Mar 2008 - 04:30:20 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive