famuvie / breedR

Statistical methods for forest genetic resources analysts
http://famuvie.github.io/breedR/
GNU General Public License v3.0
31 stars 24 forks source link

breedr_ar not in namespace #57

Closed timflutre closed 8 years ago

timflutre commented 8 years ago

I would like to use the breedr_ar function in the file ar.R. Can you make it available in the namespace?

famuvie commented 8 years ago

It has been designed to be internal (e.g. not much checking of user input). Can you use it with breedR:::breedr_ar() or it fails? Ultimately, I can make it available but hidden in the reference manuals and function index, if you really need it.

timflutre commented 8 years ago

I tried but it returned NULL. Here is a minimal example based on your test:

test.pos <- list(x = c(-2:3), y = 5:8/2)
test.coord <- as.matrix(expand.grid(test.pos$x[-2], test.pos$y))[-8, ]
test.rho <- c(.6, .8)
breedR:::breedr_ar(test.coord, test.rho, TRUE)

Call:
NULL

Error in if (x$order) { : l'argument est de longueur nulle
famuvie commented 8 years ago

Try assigning the result to some object:

my_AR <- breedR:::breedr_ar(test.coord, test.rho, TRUE)
str(my_AR)

It works fine. The error happened because you tried (implicitly) to print.ar the result, which is a method defined in package stats for time series objects. You see, this is another reason for why the method should remain internal. It avoids clashes with classes defined in other packages.