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

From: Richard M. Heiberger <>
Date: Sun, 09 Mar 2008 23:26:10 -0400


I would like an option for all comments and blanks to be echoed. The reason is that I am designing a mechanism for connecting ESS to Rgui using source(). It works for me now, but is not smooth enough to post until I do a little bit more work on it. Therefore I want an option for the R Console to display all the lines in my source() code. When the seven lines below are sourced, only lines 1,2,4,5,6 are echoed. Lines 3 and 7 are not echoed. This means that well-commented user source code will not have complete comments in the output transcript in the Console.

## comment 1

## comment 4

## comment 7

What I would also like, but I believe would be much harder for you to provide, is a way to get individual lines sent from ESS into the same place that lines that are manually typed go. The reason is that multi-line commands, such as


cannot currently be sent one line at a time (using ESS C-c C-n) to Rgui. They can be sent to any other R or S-Plus process one line at a time. I would like the same capability for the Rgui Console. The plan that I am developing now can send multiple lines over, either by highlighting them and using C-c C-r, or by surrounding them with blank lines and using C-c C-c.


-----Original Message-----
From: Duncan Murdoch [] Sent: Sunday, March 09, 2008 10:52 PM
To: Richard M. Heiberger
Subject: Re: [R] source(echo=TRUE) bug (was: source() behavior I don't understand)

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 mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Mon 10 Mar 2008 - 03:28:03 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 Please read the posting guide before posting to the list.

list of date sections of archive