J'utilise ape/vegan pour faire du bootstrap non paramétrique sur une matrice de distances de Bray-Curtis (fonction à la fin de ce message).
Quand je lance le code en utilisant TextMate, je n'ai aucun problème pour obtenir un résultat. En le lancant via R 2.8.0 (GUI ou terminal), soit le code tourne dans le vide, soit j'ai une segfault (memory not mapped).
Ce qui est étrange, c'est que le code tourne sans problème dans TextMate.
Vous avez une idée d'où ça peut venir, ou de comment je peux le contourner?
Merci
Timothée
Code : Tout sélectionner
library(ape)
library(vegan)
BS<-function(data,treetype="p",replicates=1000,title="",proportion=F)
{
dist.mat <- NULL
dist.arb <- NULL
dist.mat<-as.matrix(vegdist(data,upper=T,diag=T,method="bray"))
cat('Matrice de distance :\t\tOK\n')
dist.arb<-as.phylo(hclust(vegdist(data,method="bray"),"average"))
cat('Arbre HCLUST :\t\t\tOK\n')
bootstrap<-boot.phylo(dist.arb,data,function(xx) as.phylo(hclust(vegdist(xx,method="bray"))),B=replicates)
cat('Bootstrap :\t\t\tOK\n')
dist.bs<-(bootstrap/replicates)*100
cat('Correction bootstrap :\t\tOK\n')
bvcol <- 'red'
plot(dist.arb,treetype,use.edge.length=proportion,no.margin=F,main=title)
nodelabels(text=dist.bs,frame='n',col=bvcol,cex=0.8,adj=c(-0.4,0.4),bg='n')
tiplabels(rownames(data),frame='n',col='black',bg='n')
}
data(dune)
BS(as.matrix(dune),treetype='p',proportion=F,title='Jeu de données "dune"')