[R-sig-Geo] error using the kerneloverlaphr

Plumb, Reid@Wildlife Reid.Plumb at wildlife.ca.gov
Thu Aug 11 22:56:31 CEST 2016


Hi All,

I have been trying to use the kerneloverlaphr function in adehabitatHR to estimate home range overlap between 3 animals.  I used the recently developed dynamic Brownian Bridge Movement model (dBBMM) by Kranstauber et al. 2012 to estimate weekly home ranges.  Once created, I used the directions from  http://r-sig-geo.2731867.n2.nabble.com/adehabitatHR-combining-estUD-for-kerneloverlaphr-td7580675.html to merge the externally created UDs into a estUDm for HR overlap estimation.  All of the UDs created in the dBBMM model are the same size and are imported as ESRI raster files.  After stacking the UDs, I tried running the kerneloverlaphr() function on the estUDm but received the error:  

Error in if (slot(x[[1]], "vol")) stop("x should not be a volume under UD") :  argument is of length zero

When I try calling the estUDm, I receive the error:

Error in if (!x[[1]]@vol) { : argument is of length zero

I believe the problem has something to do with transforming the ESRI raster into a SpatialPixelsDataFrame and creating the estUDm, but I am not really sure how to remedy this issue.  I would appreciate any help you can give me.  Below is my code.  I tried attaching sample ESRI grids to reproduce the error but they are too large for this list serve.  If you can help and would like me to send you them, e-mail me directly and I will send a zip folder.  Many thanks.

library(rgdal)
library(adehabitatHR)
library(raster)

ras1 <- raster("rr1_12")
SPDX_ras1 <- as(ras1, "SpatialPixelsDataFrame")
rr1.ud <- new("estUD", SPDX_ras1)

ras2 <- raster("rr2_12")
SPDX_ras2 <- as(ras2, "SpatialPixelsDataFrame")
rr2.ud <- new("estUD", SPDX_ras2)

ras3 <- raster("rr3_12")
SPDX_ras3 <- as(ras3, "SpatialPixelsDataFrame")
rr3.ud <- new("estUD", SPDX_ras3)

rrUDm <- list(rr1.ud = rr1.ud, rr2.ud = rr2.ud, rr3.ud = rr3.ud )
class(rrUDm) <- "estUDm"
ovrlap <- kerneloverlaphr(rrUDm, method = "HR", percent = 95, conditional = FALSE)
summary(rrUDm)

Reid Plumb, M.S.
Environmental Scientist - CDFW
1724 Ball Mountain Rd.
Montague, CA 96064
E-mail: reid.plumb at wildlife.ca.gov
Cell: 419-349-2040



More information about the R-sig-Geo mailing list