在我的R包中提供第三方库 [英] Make third party library available in my R package

查看:218
本文介绍了在我的R包中提供第三方库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发使用第三方功能的R包 可在生物导体包装"methyilumi"中获得

I am developing an R package that uses third party functions available in the Bioconductor package "methyilumi"

在一开始,在我的R包的代码中,我导入了methylumi 与library(methylumi).

In the code for my R package at the very beginning I import methylumi with library(methylumi).

在开发过程中(我使用roxygen2和devtools),一切正常. 但是,当我安装软件包并运行函数时,出现错误消息: could not find function "methylumIDAT".

During the development (I use roxygen2 and devtools) everything works fine. However, when I install the package and run my functions, I get the error: could not find function "methylumIDAT".

当然,如果我手动导入软件包,一切都可以解决,但是我该如何做呢? 这样我每次加载自己的软件包时都可以使用methylumi吗?

Of course everything is solved if I import the package manually, but how can I make so that methylumi is available whenever I load my own package?

推荐答案

由于您使用的是devtools,因此可以添加

Since you are using devtools, you can add

devtools::use_package("methyilumi")

在控制台中单击

,然后在函数主体中调用methyilumi::methylumIDAT.这样,该软件包将自动在DESCRIPTION文件的Imports中列出.

in the console, and call methyilumi::methylumIDAT in the body of your function. That way, the package is automatically listed in Imports in the DESCRIPTION file.

本节提供了几种不同情况的说明: http://r-pkgs.had.co.nz/namespace.html#进口

This sections gives the instructions for several different cases: http://r-pkgs.had.co.nz/namespace.html#imports

这篇关于在我的R包中提供第三方库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆