尝试在 R - NA 时间戳记录中创建移动对象
Attempting to make a Move object in R - NA timestamp records
我正在尝试通过 'move' 包使用我自己的动物追踪数据 (.csv),但是当我 importing/projecting 它时,R 给我一个错误。下面的代码。
df <- read.csv("Tracking_Data_CSV.csv")
N17042_move<-move(df$location.long, df$location.lat, time=as.POSIXct(df$timestamp,format="%m-%d-%Y %H:%M:%S",tz="UTC"),
proj=CRS("+init=epsg:32615"))
**Error in validityMethod(as(object, superClass)): There are NA timestamps records
我已确保我的数据中没有 NA 时间戳。我不知道问题出在数据还是代码本身。我将不胜感激任何帮助。我在下面包含了一段数据,只是为了了解格式。
individual.local.identifier timestamp location.long location.lat
1 N17042 1/10/2017 0:57 373986.9 4426785
2 N17042 1/10/2017 4:01 374027.8 4427036
3 N17042 1/10/2017 9:01 373866.7 4427156
4 N17042 1/10/2017 14:01 373878.0 4427167
5 N17042 1/10/2017 19:01 373878.7 4427161
6 N17042 1/11/2017 0:01 374010.6 4427233
你的数据中有NA时间戳,因为你转换成POSIXct是错误的。
试试这个:
as.POSIXct(1/10/2017 0:57,format="%m-%d-%Y %H:%M:%S",tz="UTC")
输出将为NA。为什么?因为您的格式包括 /
而不是 -
并且您的时间戳中没有秒
试试这个:
N17042_move<-move(df$location.long, df$location.lat, time=as.POSIXct(df$timestamp,format="%m/%d/%Y %H:%M",tz="UTC"),
proj=CRS("+init=epsg:32615"))
我正在尝试通过 'move' 包使用我自己的动物追踪数据 (.csv),但是当我 importing/projecting 它时,R 给我一个错误。下面的代码。
df <- read.csv("Tracking_Data_CSV.csv")
N17042_move<-move(df$location.long, df$location.lat, time=as.POSIXct(df$timestamp,format="%m-%d-%Y %H:%M:%S",tz="UTC"),
proj=CRS("+init=epsg:32615"))
**Error in validityMethod(as(object, superClass)): There are NA timestamps records
我已确保我的数据中没有 NA 时间戳。我不知道问题出在数据还是代码本身。我将不胜感激任何帮助。我在下面包含了一段数据,只是为了了解格式。
individual.local.identifier timestamp location.long location.lat
1 N17042 1/10/2017 0:57 373986.9 4426785
2 N17042 1/10/2017 4:01 374027.8 4427036
3 N17042 1/10/2017 9:01 373866.7 4427156
4 N17042 1/10/2017 14:01 373878.0 4427167
5 N17042 1/10/2017 19:01 373878.7 4427161
6 N17042 1/11/2017 0:01 374010.6 4427233
你的数据中有NA时间戳,因为你转换成POSIXct是错误的。 试试这个:
as.POSIXct(1/10/2017 0:57,format="%m-%d-%Y %H:%M:%S",tz="UTC")
输出将为NA。为什么?因为您的格式包括 /
而不是 -
并且您的时间戳中没有秒
试试这个:
N17042_move<-move(df$location.long, df$location.lat, time=as.POSIXct(df$timestamp,format="%m/%d/%Y %H:%M",tz="UTC"),
proj=CRS("+init=epsg:32615"))