Henrik Bengtsson
2006-Mar-29 09:40 UTC
[Rd] Substitute() changed since R2.3.0 (2006-02-02 r37243)?
Hi,
I've got the following two versions of R on WinXP:
A) R Version 2.3.0 Under development (unstable) (2006-02-02 r37243)
B) R Version 2.3.0 Under development (unstable) (2006-03-27 r37579)
and a the following "test.R" script:
foo <- function(path, ...) { print(path) }
bar <- function(x, ...) foo(...)
wow <- function(x, ...) capture.output(foo(...))
bar(1, path=2)
print(wow(1, path=2))
With A, I get:
> source("test.R")
[1] 2
[1] "[1] 2"
But with B, I get> source("test.R")
[1] 2
Error in print(path) : argument "path" is missing, with no default
Further debugging led me to the following test2.R script:
foo <- function(path, ...) { print(path) }
bar <- function(x, ...) foo(...)
wow <- function(x, ...) yaa(foo(...))
yaa <- function(...) substitute(list(...))
bar(1, path=2)
print(wow(1, path=2))
With A, I get
> source("test2.R")
[1] 2
list(foo(...))
But with B, I get
> source("test.R")
[1] 2
list(foo())
Note that '...' is missing in the latest version. I don't think
this is wanted.
/Henrik
Peter Dalgaard
2006-Mar-29 09:58 UTC
[Rd] Substitute() changed since R2.3.0 (2006-02-02 r37243)?
"Henrik Bengtsson" <hb at maths.lth.se> writes:> Hi, > > I've got the following two versions of R on WinXP: > > A) R Version 2.3.0 Under development (unstable) (2006-02-02 r37243) > B) R Version 2.3.0 Under development (unstable) (2006-03-27 r37579) > > and a the following "test.R" script: > > foo <- function(path, ...) { print(path) } > bar <- function(x, ...) foo(...) > wow <- function(x, ...) capture.output(foo(...)) > bar(1, path=2) > print(wow(1, path=2)) > > With A, I get: > > > source("test.R") > [1] 2 > [1] "[1] 2" > > But with B, I get > > source("test.R") > [1] 2 > Error in print(path) : argument "path" is missing, with no default > > Further debugging led me to the following test2.R script: > > foo <- function(path, ...) { print(path) } > bar <- function(x, ...) foo(...) > wow <- function(x, ...) yaa(foo(...)) > yaa <- function(...) substitute(list(...)) > bar(1, path=2) > print(wow(1, path=2)) > > With A, I get > > > source("test2.R") > [1] 2 > list(foo(...)) > > But with B, I get > > > source("test.R") > [1] 2 > list(foo()) > > Note that '...' is missing in the latest version. I don't think this is wanted.I suspect that you're right. Just for reproduction purposes: The script is not needed, and the whole thing simplifies to the two lines: yaa <- function(...) substitute(list(...)) yaa(foo(...)) which gives list(foo()) in 2.3.0 alpha and used to give list(foo(...)). -- O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
Maybe Matching Threads
- substitute() bug by you ? [forwarded]
- R 2.3.1 and R2.3.0 crash with system() and shell() commands (PR#9207)
- MinGW and the ld bug
- R 2.3.1 and R2.3.0 crash with system() and shell() commands (PR#9208)
- "Process R is not running" on emacs 21.2.1 using ESS 5.3.0 and R2.3.0 on Mac OSX 10.4.6