Allowing partial matching on $-extraction has always been a source of accidents. Recently, someone who shall remain nameless tried names(mydata) <- "d^2" followed by mydata$d^2.
As variables in a data frame are generally considered similar to variables in, say, the global environment, it seems strange that foo$bar can give you the content of foo$bartender. In R-devel (i.e., *not* R-3.0.0 beta, but 3.1.0-to-be) partial matches now gives a warning. Of course, it is inevitable that lazy programmers will have been using code like > anova(fit1)$P [1] 0.0008866369 NA Warning message: In `$.data.frame`(anova(fit1), P) : Name partially matched in data frame and now get the warning during package checks. This can always be removed by spelling out the column name, as in > anova(fit1)$`Pr(>F)` [1] 0.0008866369 NA or by explicitly specifying a partial match with > anova(fit1)[["P", exact=FALSE]] [1] 0.0008866369 NA -- Peter Dalgaard, Professor Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd....@cbs.dk Priv: pda...@gmail.com ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel