微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用包 move 插入数据:如何创建 movestack 对象?

如何解决使用包 move 插入数据:如何创建 movestack 对象?

我刚刚开始在我的硕士论文项目中使用 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,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
),Device = c(2L,2L,2L),Box.no. = c("C23","C23","C23"),Bird.no. = c(10825325L,10825325L,10825325L),Breeding.Stage = c(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.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,Trip.no. = c(1L,Complete = c(0L,0L,0L),optional = c(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)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。