使用dplyr 0.7.4的新quosure语法,我相信我应该能够做类似!!quo(1) (期待1 )的事情,但它会返回错误
library(dplyr) !!quo(1) Error in !quo(1) : invalid argument type为什么这不起作用? (注意,在基数R中,可以执行eval(quote(1)) 。什么是dplyr模拟?)
......是!! 仅在dplyr函数中定义?
Using the new quosure syntax for dplyr 0.7.4, I believe I should be able to do something like !!quo(1) (expecting 1), yet it returns the error
library(dplyr) !!quo(1) Error in !quo(1) : invalid argument typeWhy doesn't this work? (Note that in base R, one can do eval(quote(1)). What is the dplyr analogue?)
... is !! only defined within dplyr functions?
最满意答案
!! 只在知道tidyeval框架的函数中定义,是的。 在普通的R代码中,它意味着连续两次! 的(逻辑 - 不)。
eval的等价物是rlang::eval_tidy :
eval_tidy(quo(42)) # [1] 42!! is only defined within functions that are aware of the tidyeval framework, yes. In normal R code, it means two successive !'s (logical-not).
The equivalent of eval would be rlang::eval_tidy:
eval_tidy(quo(42)) # [1] 42更多推荐
发布评论