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

marc at intershop.de marc at intershop.de
Wed Jan 12 11:50:50 CET 2005

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

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

[1] "aaa"

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


Compare with:

> df["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:

> df$aa
[1] 1   (only the first matching column is retrieved)

More information about the R-devel mailing list