From p.dalgaard@biostat.ku.dk  Sun Feb  6 00:16:35 2000
From: p.dalgaard@biostat.ku.dk (p.dalgaard@biostat.ku.dk)
Date: Sun, 6 Feb 2000 01:16:35 +0100 (MET)
Subject: [Rd] anomalies with call objects (PR#412)
Message-ID: <200002060016.BAA26878@pubhealth.ku.dk>


Call objects don't always behave as you'd expect. They're mostly
list-like, but with exceptions:

> f<-function(x,y,...)match.call(expand.dots=FALSE)
> xx <- f(y=1,2,z=3,4)
> dd <- xx$...
> xx$... <- NULL
> c(xx,dd)
[[1]]
f(x = 2, y = 1)

$z
[1] 3

[[3]]
[1] 4

> as.call(c(as.list(xx),dd))
f(x = 2, y = 1, z = 3, 4)

(Splus has this rather differently, since dd becomes a call to list()
rather than a list of promises:

S> c(xx,dd)
f(x = 2, y = 1, list, z = 3, 4)
S> as.call(c(as.list(xx),dd))
f(x = 2, y = 1, list, z = 3, 4)

..but at least gives the same in both cases)

Also, the names of arguments added with [[<- is getting dropped if a
new element is required:

> xx[["abc"]]<-123
> xx
f(x = 2, y = 1, 123)

S has what I'd expect there:

S> xx[["abc"]]<-123
S> xx
f(x = 2, y = 1, abc = 123)

[R-0.99.0 prerelease on RedHat6.1, but this is likely not a new thing.]

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] anomalies with call objects (PR#412)
p.dalgaard@biostat.ku.dk