[R-sig-Geo] grid in adehabitatHR

JLong jed.long at st-andrews.ac.uk
Tue Feb 3 10:52:05 CET 2015


Hi David,

The kernelUD 'grid' parameter expects a SpatialPixels object that represents
the raster upon which you wish to estimate the animal UD. You are passing in
only a raster with 4 pixels, which I think represent the outer corners of
the raster upon which you wish to estimate the UD. Alternatively, the grid
parameter can accept a number that represents the pixel size, and it will
automatically build the raster for you.

The problem lies in your buildup definition of the SpatialPixelsDataFrame
object. When you define a 'grid' you need to identify the locations of each
pixel in the grid and save those as columns x  and y  in the data frame. See
the 'expand.grid' function and the meuse.grid example in the function
'coordinates'.

As a test just try:
kud=kernelUD(detections[,1],h=h, grid=40, kern=c("bivnorm"))


Then, the process if you wish to define your own grid would then be:
x <- seq(xmin,xmax,by=resolution)  # where resolution is the pixel size you
desire
y <- seq(ymin,ymax,by=resolution)
xy <- expand.grid(x=x,y=y)
coordinates(xy) <- ~x+y
gridded(xy) <- TRUE
class(xy)

kud=kernelUD(detections[,1],h=h, grid=xy, kern=c("bivnorm"))

Cheers,
Jed




-----
Jed Long
Lecturer in GeoInformatics
Department of Geography & Sustainable Development
University of St Andrews, UK
--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/grid-in-adehabitatHR-tp7587722p7587727.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list