Skip to content

Instantly share code, notes, and snippets.

@fmichonneau
Last active August 29, 2015 13:57
Show Gist options
  • Save fmichonneau/9463307 to your computer and use it in GitHub Desktop.
Save fmichonneau/9463307 to your computer and use it in GitHub Desktop.
Code that fails only for sparc on CRAN
## code to reproduce error as seen at: http://www.r-project.org/nosvn/R.check/r-patched-solaris-sparc/phylobase-00check.html
## 2014-03-10
library(phylobase)
library(RUnit)
## create object from scratch
ancestor <- as.integer(c(6,7,7,6,8,0,8,9,9))
descendant <- as.integer(c(7,1,2,8,3,6,9,4,5))
edge <- cbind(ancestor, descendant)
nid.tip <- 1:5
nid.int <- 6:9
nid.all <- c(nid.tip, nid.int)
lab.tip <- paste("t", nid.tip, sep="")
lab.int <- paste("n", nid.int, sep="")
lab.all <- c(lab.tip, lab.int)
eid <- paste(ancestor, descendant, sep="-")
elen <- descendant/10
elab <- paste("e", eid, sep="")
phy <- phylo4(x=edge, tip.label=lab.tip, node.label=lab.int,
edge.length=elen, edge.label=elab)
## create altered version such that each slot is out of order with
## respect to all others; methods should be able to handle this
phy.alt <- phy
phy.alt@label <- rev(phy@label)
phy.alt@edge <- phy@edge[c(6:9, 1:5), ]
[email protected] <- [email protected][c(7:9, 1:6)]
[email protected] <- [email protected][c(8:9, 1:7)]
## build target
allDepths <- c(1.2, 1.8, 1.8, 2.1, 2.3, 0.9, 1.0, 1.2, 1.6)
names(allDepths) <- names(getNode(phy.alt))
## This fails only on sparc architecture during R CMD check on CRAN
checkIdentical(nodeDepth(phy.alt), allDepths)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment