From stephen.juggins at newcastle.ac.uk  Sun Nov 15 19:28:12 2009
From: stephen.juggins at newcastle.ac.uk (Stephen Juggins)
Date: Sun, 15 Nov 2009 18:28:12 +0000
Subject: [Rd] Problem building package for R 2.10.0 on Mac OS X
Message-ID: <467931F038D8AC4F85B4CB76256781E1132717AC68@EXSAN03.campus.ncl.ac.uk>

Hi

I have submitted a package (rioja) to CRAN.  It checks OK for all R versions and OS's except r-release-macosx-ix86 where it fails when checking the examples. Specifically, it fails because R can't find the package vegan which is needed in a function. Here is the snippet from the check results:

### Begin snippet

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

> ### * chclust
>
> flush(stderr()); flush(stdout())
>
> ### Name: chclust
> ### Title: Constrained hierarchical clustering
> ### Aliases: chclust plot.chclust bstick.chclust
> ### Keywords: cluster hplot
>
> ### ** Examples
>
> data(RLGH)
> diss <- dist(sqrt(RLGH$spec/100)^2)
> clust <- chclust(diss)
> bstick.chclust(clust, 10)
Loading required package: vegan
Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
there is no package called 'vegan'
Error in bstick.chclust(clust, 10) : could not find function "bstick"
Execution halted

### End snippet

The function bstick.chclust listed below loads the package vegan which contains bstick.default.

bstick.chclust <- function(n, ng=10, plot=TRUE, ...) {
   if (n$method != "coniss")
      stop("bstick cannot display conslink results")
   require(vegan)
   disp <- rev(n$height)
   tot.disp <- disp[1]
   disp <- abs(diff(disp))
   nobj <- length(n$height)
   bs <- bstick(nobj, tot.disp)
   yR <- range(disp[1:(ng-1)], bs[1:(ng-1)])
   if (plot) {
      plot(2:ng, disp[1:(ng-1)], type="o", ylim=yR, ylab="Sum of Squares", xlab = "Number of groups")
      lines(2:ng, bs[1:(ng-1)], col="red", type="o")
   }
   invisible(data.frame(nGroups = 2:(ng), dispersion=disp[1:(ng-1)], bstick = bs[1:(ng-1)]))
}

vegan is included as a Suggests in the DESCRIPTION file and the package checks OK on r-oldrel-macosx-ix86.  It also checks OK with R 2.10.0 on OS X on my own Mac.  My code could be improved and I should probably trap the warning issued by require, but I don't understand why vegan is not loading when checking on CRAN.  Any help will be gratefully received!

Many thanks, Steve

Steve Juggins
School of Geography, Politics & Sociology
Newcastle University   Tel: +44 (0)191 222 8799
Newcastle upon Tyne    Fax: +44 (0)191 222 5421
NE1 7RU, UK            Mobile:   +44 (0)7740054905
http://www.staff.ncl.ac.uk/staff/stephen.juggins/



[Rd] Problem building package for R 2.10.0 on Mac OS X
Stephen Juggins