[英]No need to import `!!!` operators into the package DESCRIPTION?
I'm trying to build a package using dplyr
. 我正在尝试使用
dplyr
构建一个包。 I extensively used !!
我广泛使用
!!
and !!!
和
!!!
operators from rlang
. 来自
rlang
运营商。
However, I didn't import
them explicitly although the package seems to work nevertheless. 但是,我没有明确地
import
它们,尽管这个包看起来仍然有用。
Am I missing something in the environment, or does import(dplyr)
somehow cover this? 我在环境中遗漏了什么,或
import(dplyr)
以某种方式覆盖了这个?
As a comment above stated, dplyr
re-exports tidyeval dependencies from rlang
, so if you have dplyr
in Imports you don't need to explicitly import rlang
. 如上所述,
dplyr
从dplyr
重新导出tidyeval依赖rlang
,因此如果你在Imports中有dplyr
,则不需要显式导入rlang
。 However, it might be worth asking whether you need all of dplyr
, or just the tidyeval parts - there's something to be said for keeping dependencies to a minimum. 但是,可能值得问一下你是否需要所有的
dplyr
,或者仅仅是tidyeval部分 - 还有一些东西可以说是为了将依赖关系保持在最低限度。 rlang
is a very lightweight package dependency-wise, so if you can get away with depending only on it directly it can make your package faster to install and (in theory) less likely to break with an external update. rlang
是一个非常轻量级的依赖包,所以如果你可以直接依赖它,它可以让你的包安装更快,并且(理论上)不太可能破坏外部更新。
If you find yourself using a lot of quoting and unquoting operators in package development, you can also check out the usethis package's "tidyverse development helpers" . 如果您发现自己在软件包开发中使用了很多引用和取消引用操作符,那么您也可以查看使用该软件包的“tidyverse开发助手” 。
usethis::use_tidy_eval()
"imports a standard set of helpers to facilitate programming with the tidy eval toolkit." usethis::use_tidy_eval()
“导入一组标准的助手,以便于使用整洁的eval工具包进行编程。” It's a quick and easy way to add rlang
to Imports, and imports/re-exports and documents the (en)quo(s)
, (en)sym(s)
, (en)expr(s)
, functions, .data
pronoun, and :=
. 这是一种快速简便的方法,可以将
rlang
添加到Imports,导入/重新导出并记录(en)quo(s)
, (en)sym(s)
, (en)expr(s)
,函数, .data
代词,和:=
。 Then you should have what you need to use tidyeval throughout your package. 那么你应该拥有在整个包装中使用tidyeval所需的东西。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.