[R-sig-Geo] grid in adehabitatHR

chirleu chirleu at gmail.com
Tue Feb 3 15:37:27 CET 2015


Hi Jed,
It worked! So thank you. I was close. I think I was passing a complet grid
(not only 4 points):
loc4=raster(loc,nrows=1000,ncols=1000)
but for some reason did not work. It seems the key is the expand.grid
function.

Cheers,

David

2015-02-03 10:52 GMT+01:00 JLong [via R-sig-geo] <
ml-node+s2731867n7587727h27 at n2.nabble.com>:

> 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
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://r-sig-geo.2731867.n2.nabble.com/grid-in-adehabitatHR-tp7587722p7587727.html
>  To unsubscribe from grid in adehabitatHR, click here
> <http://r-sig-geo.2731867.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=7587722&code=Y2hpcmxldUBnbWFpbC5jb218NzU4NzcyMnw3MzA1Njc5Nw==>
> .
> NAML
> <http://r-sig-geo.2731867.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/grid-in-adehabitatHR-tp7587722p7587728.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list