R包不加载依赖

前端之家收集整理的这篇文章主要介绍了R包不加载依赖前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
参见英文答案 > How can I load dependencies in an R package?2个
解决

在我的描述文件中,我改变了

  1. Imports: dplyr (>= 0.4.3),ggplot2 (>= 2.1.0),lazyeval (>= 0.1.10)

  1. Depends: dplyr (>= 0.4.3),lazyeval (>= 0.1.10)

这对我有用. “进口:”可能会贬值?

我在RStudio写一个包.我的一个依赖是dplyr.当我构建并重新加载包时,运行函数时出现以下错误

  1. > library(my_package)
  2. > my_package::get_survey(...)
  3. Error in get_survey(import_dir) : could not find function "%>%"

但是,我在描述文件中记录了我的依赖项:

  1. Imports: dplyr (>= 0.4.3),lazyeval (>= 0.1.10)

这些库安装在我的系统上,但我希望我的包能够开箱即用,而无需用户运行

  1. library(dplyr)
  2. library(ggplot2)
  3. library(lazyeval)

在使用它之前.我怎样才能解决这个问题?

这是我的sessionInfo():

  1. R version 3.3.0 (2016-05-03)
  2. Platform: x86_64-w64-mingw32/x64 (64-bit)
  3. Running under: Windows 7 x64 (build 7601) Service Pack 1
  4.  
  5. locale:
  6. [1] LC_COLLATE=English_United States.1252
  7. [2] LC_CTYPE=English_United States.1252
  8. [3] LC_MONETARY=English_United States.1252
  9. [4] LC_NUMERIC=C
  10. [5] LC_TIME=English_United States.1252
  11.  
  12. attached base packages:
  13. [1] stats graphics grDevices
  14. [4] utils datasets methods
  15. [7] base
  16.  
  17. other attached packages:
  18. [1] my_package_0.0.0.9000
  19.  
  20. loaded via a namespace (and not attached):
  21. [1] tools_3.3.0

在此先感谢您的帮助!

既然没有答案……

J_F writes

Have you tried to put the three packages under “Depends” in your DESCRIPTON?

我最近遇到了这个问题,Depends似乎仍然适用于Imports没有的地方.

猜你在找的设计模式相关文章