Skip to content

Instantly share code, notes, and snippets.

@zkamvar
Last active Dec 27, 2015
Embed
What would you like to do?
Polymorphic Information Content
pic <- function(gid){
if (gid@type != "PA"){
gid_loc <- seploc(gid)
return(vapply(gid_loc, pic_loc, 1))
}
else{
return(vapply(1:nLoc(gid), function(x) pic_loc(gid[, x]), 1))
}
}
pic_loc <- function(gid_loc){
return(1 - sum((colSums(gid_loc@tab, na.rm = TRUE)/nInd(gid_loc))^2))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment