I am trying to make a function using a !
logical operator before an ellipsis ...
.
Below is a simple example:
library(tidyverse)
myfun <- function(data, ...) {
filter(data, !(...))
}
The function does not work and throw the following error:
> myfun(iris, Sepal.Width < 4)
Error: Problem with `filter()` input `..1`.
x object 'Sepal.Width' not found
? Input `..1` is `!(...)`.
How can I make it work?
Note that for my purpose, I have to negate the condition inside myfun
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…