Skip to content
Back to formatted view

Raw Message

Message-ID: <47D4A256.6020801@stats.uwo.ca>
Date: 2008-03-10T02:52:06Z
From: Duncan Murdoch
Subject: source(echo=TRUE) bug (was: source() behavior I don't understand)
In-Reply-To: <20080309224044.DBJ17219@po-d.temple.edu>

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