使用move包转换非Movebank遥测数据为move对象时遇NA时间戳错误
问题:转换遥测数据为move对象时遭遇NA时间戳错误
我有超过10万行的遥测数据,需要转换成move对象用于布朗桥运动建模。已经花了大量时间确认列格式无误,但调用move()函数一直失败。
数据头如下:
> head(gps) # A tibble: 6 x 6 id UTC_date UTC_time Lat Long datetime <dbl> <date> <time> <dbl> <dbl> <dttm> 1 1 2022-03-01 04:32:36 47.6 17.2 2022-03-01 04:32:36 2 2 2022-03-01 05:09:09 47.6 17.2 2022-03-01 05:09:09 3 3 2022-03-01 05:24:36 47.6 17.2 2022-03-01 05:24:36 4 4 2022-03-01 05:39:11 47.6 17.2 2022-03-01 05:39:11 5 5 2022-03-01 05:54:10 47.6 17.2 2022-03-01 05:54:10 6 6 2022-03-01 06:09:07 47.6 17.2 2022-03-01 06:09:07
执行的代码:
> gps.move <- move(x=gps$Long,y=gps$Lat,time=as.POSIXct(gps$datetime, format="%Y-%m-%d %H:%M:%S", tz="UTC"), proj=CRS("+proj=longlat +ellps=WGS84"),sensor='gps',animal='ebr')
出现的错误:
Error in validityMethod(as(object, superClass)) : There are NA timestamps records
已经确认数据集无NA值,datetime列格式也正确,并且不是已解决的"Attempting to make a Move object in R - NA timestamp records"问题。现在无法开展后续分析,恳请帮助。根据建议,提供数据集的dput示例:
dput(head(gps, 30)) structure(list(id = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30), UTC_date = structure(c(19052, 19052, 19052, 19052, 19052, 19052, 19052, 19052, 19052, 19052, 19052, 19052, 19052, 19052, 19052, 19052, 19052, 19052, 19052, 19052, 19052, 19052, 19052, 19052, 19052, 19052, 19052, 19052, 19052, 19052), class = "Date"), UTC_time = structure(c(16356, 18549, 19476, 20351, 21250, 22147, 23044, 23946, 24849, 25762, 26646, 27549, 28475, 29350, 30244, 31144, 32054, 32943, 33843, 34143, 34443, 34748, 35046, 35355, 35646, 35944, 36250, 36549, 36847, 37155), class = c("hms", "difftime"), units = "secs"), Lat = c(47.640568, 47.640465, 47.640583, 47.634518, 47.634521, 47.634571, 47.628986, 47.615341, 47.616413, 47.615879, 47.610222, 47.610355, 47.610271, 47.601887, 47.590824, 47.630959, 47.667355, 47.661449, 47.657658, 47.663628, 47.665482, 47.67421, 47.682339, 47.690842, 47.68565, 47.684284, 47.680889, 47.683617, 47.687698, 47.70435), Long = c(17.16995, 17.169903, 17.170017, 17.171446, 17.171473, 17.171505, 17.156851, 17.146259, 17.144289, 17.145241, 17.145254, 17.144869, 17.144958, 17.162409, 17.182302, 17.179539, 17.175821, 17.212822, 17.216106, 17.213263, 17.217554, 17.209574, 17.207357, 17.188231, 17.155718, 17.139551, 17.143511, 17.133562, 17.136698, 17.111744), datetime = structure(c(1646105556, 1646107749, 1646108676, 1646109551, 1646110450, 1646111347, 1646112244, 1646113146, 1646114049, 1646114962, 1646115846, 1646116749, 1646117675, 1646118550, 1646119444, 1646120344, 1646121254, 1646122143, 1646123043, 1646123343, 1646123643, 1646123948, 1646124246, 1646124555, 1646124846, 1646125144, 1646125450, 1646125749, 1646126047, 1646126355), tzone = "", class = c("POSIXct", "POSIXt"))), row.names = c(NA, -30L), class = c("tbl_df", "tbl", "data.frame"))
内容的提问来源于stack exchange,提问作者Vincent
相关产品推荐
相关产品推荐

