Hello,

I hope I am writing to the correct list. I am hoping to make a feature request 
for R, and I found a guide that says to write to r-devel first to check if 
there is support for the idea.

The feature I want to suggest is an option similar to 
options(warnPartialMatchDollar=TRUE), but for cases where rather than being a 
partial match, the variable name is misspelled or simply doesn�t exist and 
attempting to use it produces NULL.

This behavior of $ can sometimes lead to unexpected outcomes, as demonstrated 
below:

dat <- data.frame(column1=1:3,column2=NA)
stopifnot(!any(is.na(dat$coluumn2)))
stopifnot(sum(dat$coluumn1) < 2)

In both cases, the data.frame returning NULL with a misspelled column name 
leads to the check in the stopifnot() silently succeeding with no warning that 
anything might be wrong.

I know there are reasons why $ returns NULL, and I�m not suggesting changing 
that. Just possibly adding an option, something like 
options(warnNonexistDollar=TRUE), that people could turn on if they would find 
it helpful to get a warning in cases like the example above.

Is this something that�s likely to have enough support to be worth submitting 
as a feature request?

Thank you,
Kristen

        [[alternative HTML version deleted]]

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to