[R] Export kde object as shapefile

T.D.Rudolph tylerdeanrudolph at gmail.com
Sat Nov 28 19:23:41 CET 2009




Tyler Dean Rudolph wrote:
> 
> I am trying to estimate home range size using the plug-in method with
> kernel density estimation in the kernel smoothing (ks) package.  Unless
> there is another way I am not familiar with, in order to calculate spatial
> area under the space I need to convert my kde () object into a spatial
> object somehow in order to calculate its spatial area.  Could someone
> demonstrate how this might be done?
> 

Here is a plausible solution from the R-sig-geo forum....

On Fri, Nov 27, 2009 at 5:20 PM, Michael Sumner <mdsumner at gmail.com> wrote:

    Here's one way:

    library(ks)

    data(unicef)
    H.scv <- Hscv(x=unicef)
    fhat <- kde(x=unicef, H=H.scv)
    image(fhat$eval.points[[1]], fhat$eval.points[[2]], fhat$estimate)

    library(sp)

    spkde <- image2Grid(list(x = fhat$eval.points[[1]], y =
    fhat$eval.points[[2]], z = fhat$estimate))
    contour(spkde, add = TRUE)
-- 
View this message in context: http://n4.nabble.com/Export-kde-object-as-shapefile-tp853920p919196.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list