[Rd] source(echo=TRUE) bug (was: [R] source() behavior I don't understand) (PR#10923)
murdoch at stats.uwo.ca
murdoch at stats.uwo.ca
Mon Mar 10 03:15:11 CET 2008
On 09/03/2008 10:01 PM, Richard M. Heiberger wrote:
> temp.ttt <- "ttt <- 1\nttt"
> conn.ttt <- textConnection(temp.ttt)
> source(conn.ttt, echo=TRUE) ## name of variable is echoed
> close(conn.ttt)
> cat(file="c:/temp/temp.R", temp.ttt) ## name of variable not echoed
> source("c:/temp/temp.R", echo=TRUE)
>
>
> temp.abc <- "abc <- 1\nabc"
> conn.abc <- textConnection(temp.abc)
> source(conn.abc, echo=TRUE) ## name of variable is echoed
> close(conn.abc)
> cat(file="c:/temp/temp.R", temp.abc) ## name of variable is echoed
> source("c:/temp/temp.R", echo=TRUE)
>
>
> The behavior I don't understand is why the variable name "ttt" is not echoed
> when sourced from a file. It is echoed when sourced from a character string.
> The name is echoed in both situations when it begins with a letter other
> than "t". Specifically I have tested "tt" and "ttt".
Looks like a bug in a regular expression. R doesn't echo lines
containing nothing but blanks and tabs, and I think the regular
expression that is supposed to match tabs is matching t instead. Thanks
for the report, I'll fix it.
Duncan Murdoch
More information about the R-devel
mailing list