Sunday, October 16, 2011

Updating "phytools" package

Today I'm working on the next release of "phytools" v0.1-0. I have a manuscript that describes the "phytools" library that has been reviewed and accepted pending revision at Methods in Ecology & Evolution (link down at time of writing; also, read the journal here). In the article reviews I received some helpful suggestions to bring "phytools" in line with best practices for writing R extensions, and I am presently working on implementing some of these.

Among other suggestions, one thing that thing that was recommended was that I should move internally used dependencies in the DESCRIPTION file from the "Depends:" line to the "Imports:" line. Then, you can add to the NAMESPACE file a line specifying which functions should be loaded from which packages. For instance, the function hessian() in the "numDeriv" package is called by my function evol.vcv(). In the DESCRIPTION file we put:

Imports: numDeriv, ...

and in the NAMESPACE file we put:

importFrom(numDeriv,hessian)

Seems to work.

4 comments:

  1. BTW, phytools didn't even have a NAMESPACE file before. . . .

    ReplyDelete
  2. Will take this tip to heart; any more advice on building packages would be appreciated!

    (Gonna try my hand at it next week...)

    ReplyDelete
  3. Some handy stuff here. (Says "for Windows" but much of it is quite general.)

    ReplyDelete
  4. That's fine... I'm a Windows person.

    Speaking of which, I wonder how people get around without file.choose() sometimes.

    ReplyDelete