我刚刚开始在我的硕士论文项目中使用R,我正在尝试使用package move来插值企鹅跟踪数据的采样率。然而,当试图创建一个movestack对象时,我得到了这个错误:
Error in validityMethod(as(object, superClass)) :
There are NA timestamps records
这个警告信息
In addition: Warning messages:
1: In showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) :
Discarded ellps WGS 84 in Proj4 definition: +proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs
2: In showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) :
Discarded datum WGS_1984 in Proj4 definition
代码:
alltripsfiltered <- read.csv(file = "C:/Users/Admin/OneDrive - Massey University/Documents/Korora/GPS data for all trips/alltracksfiltered00.csv")
tracks.move<- move(x=alltripsfiltered$Long, y=alltripsfiltered$Lat, time =as.POSIXct(alltripsfiltered$datetime, format="%Y-%m-%d %H:%M:%OS", tz="UTC"), proj=CRS("+init=epsg:3857"), animal=alltripsfiltered$TripID)
数据:
dput(alltripsfiltered[1:6, ])
structure(list(X = 1:6, Deployment = c(1L, 1L, 1L, 1L, 1L, 1L
), Device = c(2L, 2L, 2L, 2L, 2L, 2L), Box.no. = c("C23", "C23",
"C23", "C23", "C23", "C23"), Bird.no. = c(10825325L, 10825325L,
10825325L, 10825325L, 10825325L, 10825325L), Breeding.Stage = c(1L,
1L, 1L, 1L, 1L, 1L), Long = c(174.78327, 174.78326, 174.78332,
174.78323, 174.78325, 174.78277), Lat = c(-41.09482, -41.09491,
-41.09484, -41.09491, -41.09496, -41.09564), datetime = c("18/09/2020 4:13",
"18/09/2020 4:14", "18/09/2020 4:15", "18/09/2020 4:16", "18/09/2020 4:17",
"18/09/2020 4:18"), TripID = c(1L, 1L, 1L, 1L, 1L, 1L), Trip.no. = c(1L,
1L, 1L, 1L, 1L, 1L), Complete = c(0L, 0L, 0L, 0L, 0L, 0L), optional = c(TRUE,
TRUE, TRUE, TRUE, TRUE, TRUE)), row.names = c(NA, 6L), class = "data.frame")
我不确定这是因为R中的问题还是因为我的数据集。我打算使用"movestack"对象运行代码的其余部分,然后将其拆分为单独的行程,这样我就可以提取用于计算起始范围的值:
tracks.split<- split(tracks.move)
##interpolate the first track
track1interpolated<-interpolateTime(tracks.split$X1, time=as.difftime(1, units="mins"), spaceMethod=c('greatcircle'))
track1interpolated
##continue to do this for all tracks (change to X2, X3….),
您的日期时间输入与您在时间参数中输入的格式不同:
tracks.move<- move(x=alltripsfiltered$Long, y=alltripsfiltered$Lat, time =as.POSIXct(alltripsfiltered$datetime, format="%d/%m/%Y %H:%M", tz="UTC"),
proj=CRS("+init=epsg:3857"), animal=alltripsfiltered$TripID)