[Rd] substitute(x$y)) corrupts 'y' component (PR#731)
Peter Dalgaard BSA
p.dalgaard@biostat.ku.dk
08 Nov 2000 20:55:20 +0100
Thomas Lumley <thomas@biostat.washington.edu> writes:
> z<-quote(x$y)
> x<-list(y=1:3)
> and you want to produce
> list(y=1:3)$y
>
> Suggestions?
Double substitute and eval, but there's a hitch:
> eval(substitute(substitute(z,list(x=x)),list(z=z)))
structure(list(y = c(1, 2, 3)), .Names = "y")$y
which is hardly avoidable since
> dput(x)
structure(list(y = c(1, 2, 3)), .Names = "y")
However,
> x<-quote(list(y=1:3))
> eval(substitute(substitute(z,list(x=x)),list(z=z)))
list(y = 1:3)$y
--
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._