mwpennell / arbutus

Assessing the adequacy of phylogenetic models of quantitative trait evolution
7 stars 2 forks source link

Use of diversitree::: calls in pkg #19

Closed mwpennell closed 9 years ago

mwpennell commented 9 years ago

R CMD check --as-cran gets grumpy at the calls to internal diversitree functions

* checking dependencies in R code ... NOTE
Unexported objects imported by ':::' calls:
  ‘diversitree:::get.cache’ ‘diversitree:::is.constrained’
  See the note in ?`:::` about the use of this operator.
richfitz commented 9 years ago

Stinkballs, of course it would.

I'm not keen to shepherd another diversitree release through CRAN just for this, so I think the simplest thing is to duplicate these functions within arbutus. We can put them in R/internal-diversitree.R and add a note there (and I'll add a corresponding note in diversitree). If I ever open these up, then we can remove these functions very easily.

The function definitions are extremely simple:

is.constrained <- function(x) {
  inherits(x, "constrained")
}
get.cache <- function(x) {
  if (inherits(x, "big.brother") || is.constrained(x)) {
    get.cache(attr(x, "func"))
  } else {
    environment(x)$cache
  }
}