[Rd] Field initialization order bug?
Peter Dalgaard
P.Dalgaard at biostat.ku.dk
Tue Jul 17 14:34:02 CEST 2007
Prof Brian Ripley wrote:
> On Mon, 16 Jul 2007, Daniel Wilhelm wrote:
>
>
>> I believe that I may have found a bug in R. The top code sample gives
>>
>
> You have 'merely' found a bug in your understanding. What type did you
> expect 'a' to be? If you expected a list, that is not what happens in the
> first example, and you need
>
> a <- list()
>
> or, better,
>
> a <- vector("list", 2)
>
>
To be precise, you need
a <- vector("list", 2) ; names(a) <- c("field1", "field2")
or you end up with a 4-element list.
--
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
More information about the R-devel
mailing list