2014-12-05 17 views
0

我有一些数据可以从10个动物中产生一些随机点。每个数据集我都复制了100次。下面我已经分离出数据1动物并为每个代表生成了内核UD。现在我想通过结合UD来产生总结的估计密度图,然后我可以继续测量50%和90%的原点范围以及其他指标。如何将estUD结合到单层

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") 

回答

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]] 
[email protected] <- 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) 
+0

谢谢您的帮助,这完美的作品! – user3237130 2014-12-07 10:41:55