2014-12-05 21 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