我是空间数据分析的新手,实际上只是想正确格式化我的代码,以便在adeHabitatHR中运行某些命令。无论我创建空间数据框多少次,每次尝试运行mcp.area都会报告相同的错误。我真的需要有人检查我的代码并告诉我我做错了什么
liz = read.csv("timestamped.csv") #read my data in from a csv file
liz.df = liz #establish this as a data object
liz_matrix = cbind(liz.df$easting,liz$northing) #set a matrix as coordinates
head(liz_matrix) # check the head of the matrix - looks good
lizcrs = CRS("+proj=utm +zone=15 +ellps=WGS84 +datum=WGS84 +units=m +no_def") #set an object to a CRS
liz_sp = SpatialPoints(liz.df[, c("easting","northing")],proj4string = lizcrs) #establish my spatial points object
class(liz_sp) #check the class - is indeed spatial points data
head(liz_sp) #check the head, looks good
liz_spdf = SpatialPointsDataFrame(coords = liz_matrix, data = liz, proj4string = lizcrs) #establish my spatial data frame
head(liz_spdf) #check the head, normal
mcp.area(liz.spdf[,1]) #error, says I must have at least 5 relocations, cannot figure out the problem. `
这也是从head(liz_spdf)行读取的控制台以及mcp.area命令的错误消息:
> head(liz_spdf)
> lizard.id timestamp easting northing
> 1 3DDGF2 54:00.0 484759.8 3901187
> 2 3DDGF2 52:00.0 484780.7 3901189
> 3 3DDGF2 43:00.0 484761.3 3901189
> 4 3DDGF2 14:00.0 484772.3 3901197
> 5 3DDGF2 47:00.0 484761.8 3901189
> 6 3DDGF2 19:00.0 484761.8 3901189
> mcp.area(liz.spdf[,1])
Error in mcp(xy, percent = x, unin, unout) :
At least 5 relocations are required to fit an home range