From marc at intershop.de  Wed Jan 12 11:50:50 2005
From: marc at intershop.de (marc@intershop.de)
Date: Wed Jan 12 11:50:53 2005
Subject: [Rd] mydataframe$colname: using substring of colname may also match
	some column (PR#7496)
Message-ID: <20050112105050.788FBFB8F@slim.kubism.ku.dk>

Full_Name: Marc Mamin
Version: 1.8, 2.0.0
OS: Windows & Linux
Submission from: (NULL) (217.17.202.254)


Using only the beginning of a column name will match it:

>aaa<-1
>df<-as.data.frame(aaa)
>names(df)
[1] "aaa"

>df$a   
[1] 1 !!!!!!!!! (I expect df$a to be undefind)

>df$x
>NULL

Compare with:

> df["aaa"]
  aaa
1   1

> df["a"]
Error in "[.data.frame"(df, "a") : undefined columns selected


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)


[Rd] mydataframe$colname: using substring of colname may also match some column (PR#7496)
marc@intershop.de