如何将estUD组合成单层

时间:2014-12-05 15:08:50

标签: r

我有10个动物的一些数据,我从中生成了一些随机点。每个数据集我都复制了100次。下面我已经分离出数据1动物并为每个代表生成了内核。我现在想要将UD组合起来,以便能够生成一个总和的估计密度图,然后我可以继续测量50%和90%的家庭范围以及其他指标。

bat.master <- read.csv("C:/Users/Sim/Dropbox/Wallington GIS/bat.master")

names(bat.master)

# subset data frame to 1st bat only
bat1 <- bat.master$id="Y2889a"

xybat1 <- subset(bat.master, bat.master$id == "Y2889a",select=x:loopno )

# change to spatial points
xy <- xybat1[1:2]  # first two rows save as coords
SPDF <- SpatialPointsDataFrame(coords=xy, data=df)  # combine df and xy


ud1 <- kernelUD(SPDF, h = "href", same4all = TRUE, kern = "bivnorm") 

1 个答案:

答案 0 :(得分:0)

不确定我是否理解你的问题,但你可以尝试这样的事情:

library(adehabitatHR)

## generate some dummy data
SPDF <- SpatialPointsDataFrame(coords=cbind(rnorm(1000), rnorm(1000)),
                               data=data.frame(id=rep(1:10, each=100)))

udHR <- kernelUD(SPDF, h = "href", same4all = TRUE, kern = "bivnorm") 


## I would proceed using the raster packages
library(raster)
ud1 <- stack(lapply(udHR, raster))

## You can now check the first one
plot(ud1[[1]])

## or at all of them
plot(ud1)

## take the mean
plot(udm <- mean(ud1))

## now you can either proceed in raster and calculate your isopleths or convert it back to a estUD, this is a bit of a hack and not the nicest way to do it
udHR <- udHR[[1]]
udHR@grid <- as(udm, "GridTopology")

## now you can work with udHR as if it were a HR estimate
plot(getverticeshr(udHR, percent=95))
plot(getverticeshr(udHR, percent=50), add=TRUE)