# NOT RUN {
# }
# NOT RUN {
library(maps)
data(ecospat.testMdr)
data<- ecospat.testMdr
fixed.sources.rows<-order(data$date)[1:2] #first introductions
#plot observed situation
plot(data[,2:1],pch=15,cex=0.5)
points(data[fixed.sources.rows,2:1],pch=19,col="red")
text(data[,2]+0.5,data[,1]+0.5,data[,3],cex=0.5)
map(add=T)
# mca
obs<-ecospat.mdr(data=data,
xcol=2,
ycol=1,
datecol=3,
mode="min",
rep=100,
mean.date.error=1,
fixed.sources.rows)
#plot results
lwd<-(obs[[1]]$bootstrap.value)
x11();plot(obs[[1]][,3:4],type="n",xlab="longitude",ylab="latitude")
arrows(obs[[1]][,1],obs[[1]][,2],obs[[1]][,3],obs[[1]][,4],length = 0.05,lwd=lwd*2)
map(add=T)
points(data[fixed.sources.rows,2:1],pch=19,col="red")
text(data[fixed.sources.rows,2]+0.5,data[fixed.sources.rows,1]+0.5,data[fixed.sources.rows,3],
cex=1,col="red")
title(paste("total routes length : ",
round(obs[[2]],2)," Deg","\n","median dispersal rate : ",
round(obs[[3]],2)," Deg/year","\n","number of outcoming nodes : ",
obs[[4]]))
# }
Run the code above in your browser using DataLab