From tplate at acm.org  Wed Jan 12 17:57:44 2005
From: tplate at acm.org (Tony Plate)
Date: Wed Jan 12 17:57:58 2005
Subject: [Rd] mydataframe$colname: using substring of colname may
	also match some column (PR#7496)
In-Reply-To: <20050112105050.788FBFB8F@slim.kubism.ku.dk>
References: <20050112105050.788FBFB8F@slim.kubism.ku.dk>
Message-ID: <6.2.0.14.2.20050112095404.05d35dc8@mailhost.blackmesacapital.com>

At Wednesday 03:50 AM 1/12/2005, marc@intershop.de wrote:
>Full_Name: Marc Mamin
>Version: 1.8, 2.0.0
>OS: Windows & Linux
>Submission from: (NULL) (217.17.202.254)
>
>[snipped issues previously responded to]
>
>Here another example that underline how problematic this issue can be:
>
>aa1<-1
>aa2<-2
>df<-as.data.frame(aa1,aa2)
> > df$aa
>[1] 1   (only the first matching column is retrieved)

Actually, the above commands constructed a data frame with one column (the 
second argument to 'as.data.frame' is 'row.names'):

 > aa1<-1
 > aa2<-2
 > df <- as.data.frame(aa1,aa2)
 > df
   aa1
2   1
 > dim(df)
[1] 1 1

When a data frame (or list) does have columns whose names have common 
prefixes, the behavior is as documented (NULL is returned):

 > df2 <- data.frame(aa1, aa2)
 > df2
   aa1 aa2
1   1   2
 > df2$aa
NULL
 >


[Rd] mydataframe$colname: using substring of colname may also match some column (PR#7496)
Tony Plate