if (FALSE) {
## Loads the data
data(puechabonsp)
locs <- puechabonsp$relocs
map <- puechabonsp$map
## compute the home range of animals (e.g. using the minimum convex
## polygon)
pc <- mcp(locs[,"Name"])
## rasterize it
hr <- do.call("data.frame", lapply(1:nrow(pc), function(i) {
sp::over(map, geometry(pc[i,]))
}))
names(hr) <- slot(pc, "data")$id
coordinates(hr) <- coordinates(map)
gridded(hr) <- TRUE
## Compute the number of relocation in each pixel of the map
cp <- count.points(locs[,"Name"], map)
## prepares the data for the kselect analysis
x <- prepksel(map, hr, cp)
tab <- x$tab
dud <- dudi.mix(tab, scannf = FALSE, nf = 2)
## the randomisation tests
## be patient, this can be very long on some machines
(te <- rand.kselect(dud, x$factor, x$weight, nrep = 500))
}
Run the code above in your browser using DataLab