From P.Dalgaard at biostat.ku.dk  Tue Jul 17 14:34:02 2007
From: P.Dalgaard at biostat.ku.dk (Peter Dalgaard)
Date: Tue, 17 Jul 2007 14:34:02 +0200
Subject: [Rd] Field initialization order bug?
In-Reply-To: <Pine.LNX.4.64.0707170821220.30535@auk.stats>
References: <p0624081dc2c19b42aa26@[128.165.72.98]>
	<Pine.LNX.4.64.0707170821220.30535@auk.stats>
Message-ID: <469CB73A.7030006@biostat.ku.dk>

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



[Rd] Field initialization order bug?
Peter Dalgaard