search for: not_f

Displaying 1 result from an estimated 1 matches for "not_f".

Did you mean: not_
2010 Aug 30
1
Surprising behavior of Negate()
...R-developers, I find the current behavior of Negate() somewhat confusing. It does not match the passed function 'f' until the returned function is called for the first time. To see an example of what this can do see the following (contrived) example: f <- function(x) is.integer(x) not_f <- Negate(f) f <- function(x) is.character(x) ## Both should, in my mind, return TRUE: not_f(1) == !is.integer(1) not_f(1L) == !is.integer(1L) I propose to change Negate() in the following way: ## Easy 'fix': Negate <- function(f) { f <- match.fun(f) func...