From ripley at stats.ox.ac.uk  Wed Jun 13 16:51:36 2007
From: ripley at stats.ox.ac.uk (ripley at stats.ox.ac.uk)
Date: Wed, 13 Jun 2007 16:51:36 +0200 (CEST)
Subject: [Rd] (PR#9733) subset() only returns first of equally named
Message-ID: <20070613145136.9C08948DC7@slim.kubism.ku.dk>

>From NEWS for 2.5.0 patched:

     o   <a data.frame>[i, j] could sometimes select the wrong column
         when j is numeric if there are duplicate column names.

> subset(test, TRUE, c(2,3))
   a a.1
1 2   3

Please do not report bugs that are already fixed (as asked in the FAQ).


On Wed, 13 Jun 2007, beierm at uni-duesseldorf.de wrote:

> Full_Name: Manfred Beier
> Version: 2.5.0 (2007-04-23)
> OS: linux-gnu
> Submission from: (NULL) (134.99.204.101)
>
>
> When multiple columns in a data.frame have the same name, only the first of them
> is returned by the subset() function even when selected numerically.
>
>> test <- data.frame(cbind(1,2,3))
>> names(test) <- c("a","a","a")
>> test
>  a a a
> 1 1 2 3
>> subset(test, TRUE, c(2,3))
>  a a.1
> 1 1   1
>
> For matrices subset() works correctly.
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] (PR#9733) subset() only returns first of equally named
ripley at stats.ox.ac.uk