简体   繁体   English

对于某些功能,导入的软件包不能与R中的软件包一起使用?

[英]Imported packages do not work with my package in R for some functions?

I built my own package. 我建立了自己的程序包。 I imported the most important package that I need them in my package. 我在包中导入了我需要的最重要的包。 In these packages there are some functions are not exported by the package (I did not find them in the namespace of the package). 在这些包中,有些功能不是由包导出的(我没有在包的名称空间中找到它们)。 I need these functions. 我需要这些功能。 When I call them, I get an error that those funciton are not found. 当我给他们打电话时,我得到一个错误,即找不到那些功能。 So, How I can solve this problem. 所以,我该如何解决这个问题。 Also, how does these packages uses this functions inside their packages without using @export!! 而且,这些软件包如何在其软件包中使用此功能而不使用@export! any help please? 有什么帮助吗?

based on the answer: 根据答案:

I understand I do it like this inside my R code: I need the following function: 我了解我是在我的R代码中这样做的:我需要以下功能:

args <- preproc(c(as.list(environment()), call = match.call()),
               check_matrix,
                check_fammat,
                check_parmat,
                check_par2mat)
           list2env(args, environment())

Then I must do like this: 然后我必须这样做:

VineCopula:::preproc()

Then how to call args ? 那怎么叫args

You can call non exported functions with 您可以使用

packagename:::functionname()

It is however not recommended to do that since those functions might not be supported in future versions of packages. 但是,不建议这样做,因为在将来的软件包版本中可能不支持这些功能。

If you want to use a non exported function from your own library inside your own library, you can just use functionname() altough some package developers still prefer packagename:::functionname() . 如果要在自己的库中使用自己库中的非导出函数,则可以只使用functionname()尽管某些程序包开发人员仍然更喜欢packagename:::functionname()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM