AdehabitatHR 的 MCP Home 范围太小

MCP Home range with AdehabitatHR too small

我是使用 R 进行空间分析的新手。我正在尝试主要使用 R 中的 adehabitatHR 包来计算每日家庭范围(MCP 100,后来的 95 和 50 %)。我使用了同事提供的脚本它一直对她有用。现在,当我 运行 它时,它可以工作,但我收到的 e-xx 值太小了。 我真的不知道哪里出了问题,我认为它与投影有关,但我太缺乏经验不知道哪个更好。

您可以看到下面的代码。也许有人知道如何解决这个问题?

library (adehabitatHR)
library (sp)
library (scales)  # helps make Polygons partly transparent using the alpha argument below 
library(dplyr)

# Read data frame into R 
tab1<-read.csv(file="animals.csv",sep=",",header=TRUE)

# Remove two rows with NA´s 
tab1 <- tab1 [!is.na(tab1$x_) & !is.na(tab1$y_),]

# Only include three columns (AnimalID + Exp, x and y coordinates) for making MCP´s 
# Creating new ID to group days and AnimalID
tab2 <- tab1 [, c("id", "x_", "y_", "day", "month", "year")] # week, month, day + month
tab2$Time <- paste(tab2$day, tab2$month, sep= " ") #  day + month
tab2$Time2 <- paste(tab2$Time, tab2$year)
tab2$Mix <- paste(tab2$AnimalID, tab2$Time2, sep= " ") # id + time 
tab3 <- tab2 [, c("Mix", "x_", "y_")]
tibble(tab3)

# Check in tab2 which Animal has less than 5 GPS location
tab4 <- tab3 %>%
  group_by(Mix) %>%
  summarise(n = n())

# Filter data with less than 5 
tab5<-filter(tab4, n > 5)
tab6<-filter(tab4, n < 5)
  
# Remove rows from data set which have less than 5 GPS location
tab7 <- tab3 %>% 
  filter(!grepl(" 31 May 2019", Mix))
tab8 <- tab7 %>% 
  filter(!grepl(" 29 Jun 2019", Mix))

# Create a SpatialPointsDataFrame by defining the coordinates
coordinates(tab8) <- c("x_", "y_")
str(tab8)

# Set the coordinate reference system, (CRS) 
# The sample data are UTM points in WGS84 from zone 33N 
proj4string(tab8) <- CRS( "+proj=utm +zone=33N +datum=WGS84 +units=m +no_defs" )

animals.mcp <- mcp(tab8[, "Mix"], percent = 100, unin = "m", unout = "m2") 
as.data.frame(animals.mcp)

输出数据如下所示:

                      id         area
 1 Dec 2019    1 Dec 2019 5.180087e-03
 1 Feb 2020    1 Feb 2020 7.171711e-04
 1 Jan 2020    1 Jan 2020 1.692209e-03
 1 Jul 2019    1 Jul 2019 3.384402e-07
 1 Jun 2019    1 Jun 2019 1.829374e-01
 1 Nov 2019    1 Nov 2019 7.794313e-04
...

提前致谢!

所以我可以通过添加

来解决它
coordinates(tab7) <- c("x_", "y_") 
proj4string(tab7) <- CRS("+init=epsg:4326") 
tab8 <- spTransform(tab7, CRS("+proj=utm +zone=33N +datum=WGS84 +units=m +no_defs"))

所以先告诉R使用什么坐标系,然后投影到需要的区域。

希望这对有同样问题的其他人有所帮助!