2

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
Tomas Greif
  • 21,685
  • 23
  • 106
  • 155

1 Answers1

2

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

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

GSee
  • 48,880
  • 13
  • 125
  • 145
  • Thank you. In other words, you cannot have examples for functions which are not exported? It is strange that I can call the function from command line but `check()` is not able to find the function. – Tomas Greif Jul 16 '13 at 18:39
  • 1
    You could either use a fully qualified name (`riv:::iv.num()`) or you could ["not run" the examples](http://stackoverflow.com/questions/12038160/how-to-not-run-an-example-using-roxygen2) – GSee Jul 16 '13 at 18:43