[Rd] Field initialization order bug?

From: Daniel Wilhelm <dwilhelm_at_lanl.gov>
Date: Mon, 16 Jul 2007 16:06:06 -0600

I believe that I may have found a bug in R. The top code sample gives an error as shown. However, by simply switching which field is initialized first as in the bottom code sample, it works as expected.

This gives an error:

a <- NULL
a[["field1"]] <- 1
a[["field2"]] <- matrix(c(2,1), 1)

Error in a[["field2"]] <- matrix(c(2, 1), 1) :

        more elements supplied than there are to replace

Yet, this works as expected:

a <- NULL
a[["field2"]] <- matrix(c(2,1), 1)
a[["field1"]] <- 1

Daniel Wilhelm

R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Tue 17 Jul 2007 - 07:23:35 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 17 Jul 2007 - 11:36:35 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.