Skip to content
Prev 1603 / 63421 Next

as.list

I don't understand the behavior of "as.list"
(really as.list.default) on arguments which
are expressions. An artificial example:
[[1]]
<-

[[2]]
<-

as.list.default contains the following code:

 if (is.expression(x)) {
        l <- vector("list")
        for (sub in x) l <- c(l, sub[[1]])

--- why the sub[[1]] part?

eliminating the [[1]], I get:
[[1]]
x <- 1

[[2]]
y <- 2


Kjetil Halvorsen
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._