check()新的R包 [英] check() new R package

查看:125
本文介绍了check()新的R包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么 check()无法在我的程序包中找到函数?我有一个带有功能 iv.num 的小包装。我在文档中的示例是 iv.num(german_data, mob, gbbin)。如果我运行 check(),则会出现错误-找不到函数。但是,我可以运行该功能,没有任何问题,如下所示。我正在使用R 3.0.1。和 devtools (在 check()之前使用 load_all() 。不幸的是,我无法创建可复制的示例,该程序包位于 github

Why check() is not able to find function in my package? I have a small package with function iv.num. My example in documentation is iv.num(german_data,"mob","gbbin"). If I run check(), I get error - could not find function. However, I am able to run the function without any problems as shown below. I'm using R 3.0.1. and devtools (using load_all() before check(). Unfortunately, I am not able to create reproducible example, the package is on github

* checking examples ... ERROR
Running examples in 'riv-Ex.R' failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: iv.num
> ### Title: Calculate Information Value for numeric (double/integer) vectors
> ### Aliases: iv.num
> 
> ### ** Examples
> 
> iv.num(german_data,"mob","gbbin")
Error: could not find function "iv.num"
Execution halted
Error: Command failed (1)
> iv.num(german_data,"mob","gbbin")
  variable       class outcome_0 outcome_1     pct_1     pct_0      odds         woe          miv
1      mob     (;11.5)       153        27 0.0900000 0.2185714 0.4117647 -0.88730320 1.140818e-01
2      mob <11.5;15.5)       189        62 0.2066667 0.2700000 0.7654321 -0.26731477 1.692994e-02
3      mob   <15.5;19)        72        43 0.1433333 0.1028571 1.3935185  0.33183186 1.343129e-02
4      mob   <19;34.5)       198        86 0.2866667 0.2828571 1.0134680  0.01337813 5.096429e-05
5      mob     <34.5;)        88        82 0.2733333 0.1257143 2.1742424  0.77668029 1.146528e-01


推荐答案

您没有导出 iv.num 。我通过查看 NAMESPACE 文件看到了这一点。

You did not export iv.num. I saw that by looking at the NAMESPACE file.

添加#'@export iv.num 上方的roxygen注释块,就像您对要导出的其他函数所做的一样。

Add #' @export to the roxygen comment block above iv.num like you did with your other functions that are being exported.

这篇关于check()新的R包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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