且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在R包中加载依赖项?

更新时间:2022-05-23 22:37:29

任一:

  • 使用来自以下位置的软件包明确为函数添加前缀:ncdf4::nc_open(...)

或者:

  • 在您的NAMESPACE文件importFrom(ncdf4, nc_open)中添加一行,然后在您的代码中调用不带软件包的函数:nc_open(...)
  • add a line in your NAMESPACE file importFrom(ncdf4, nc_open) and then in your code, call the function without the package: nc_open(...)

除了为要导入的每个函数添加importFrom行之外,您还可以使用import(ncdf4)来封装该程序包中的所有内容.

Rather than adding an importFrom line for every function you want to import, you can also use import(ncdf4) to snarf everything from that package.