1 year ago
#260946
Arne Devriese
r function for Hanski Connectivity Index
I had to calculate the Hanski connectivity index for my habitat patches, but was unable to find a package that had a function for this. So I wrote one myself. I wanted to share it in case it could be useful for someone else. It is also the first function i wrote from scratch, so please let me know If I made a mistake.
Formula for Hanski connectivity index
This is my function, with area a vector with the respective patch areas and dist a matrix with the interpatch distances. Alp and bet are numerical constants. Area and dist can easily be obtained with the function "patch_config(x, units = c("m", "km"))" from the package "metacapa"patch_config: Calculate interpatch distances and areas.
HanskiIC<-function(area, dist, alp, bet){ alphmat<-matrix(-alp,1,1)
alphdist<-dist*c(alphmat)
IC<-(exp(alphdist)%*%(area^bet))-area^bet
return(IC)}
ps: i hope I posted this on the right platform and it can be useful for someone else.
r
patch
landscape
0 Answers
Your Answer