Stephen Juggins
2009-Nov-15 18:28 UTC
[Rd] Problem building package for R 2.10.0 on Mac OS X
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/
Prof Brian Ripley
2009-Nov-15 20:04 UTC
[Rd] Problem building package for R 2.10.0 on Mac OS X
Please ask such questions on R-sig-mac, or directly to the Mac package builder (Simon Urbanek). As you will see from http://cran.r-project.org/web/checks/check_summary.html at least 150 packages are in the same boat (not building because dependencies are missing), so something has gone wrong on the build machine. There seem to be results for 'vegan', but they are for a pre-release (2.10.0 alpha), not the released version. Perhaps related, there have been no R-patched builds on r.research.att.com for 'leopard' (the main R build for R 2.10.0) since Nov 4. Simon has been travelling, and will no doubt get to this when he has time. Meanwhile, Mac users can fairly easily build packages from the sources (provided they have installed Xcode), so this is not something to fret about. One point specific to Mac is that the distributed packages are tri-architecture (i386, x86_64, ppc) and so need to work on all three archs to get distributed (at least in principle). There have been quite a few packages (including earlier versions of yours) that failed on 64-bit platforms. On Sun, 15 Nov 2009, Stephen Juggins wrote:> 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/ > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595