首页 > 解决方案 > 将时间戳转换为 POSIXct 格式返回双精度

问题描述

我想ltraj使用 R 包将数据框转换为列表adehabitatLT,为此我必须将时间戳转换为POSIXct格式。我正在编写以下代码:

martin_df$timestamp <- as.POSIXct(martin_df$timestamp,
                                      format="%Y-%m-%d %H:%M:%OS", tz="GTM")

并且没有错误。但是当我要求:

typeof(martin_df$timestamp)

它告诉我是双倍的。

martin.ltraj <- as.ltraj(martin_df, typeII = TRUE)

as.ltraj(martin_df, typeII = TRUE) 中的错误:对于类型 II 的对象,日期应属于“POSIXct”类

有谁知道错误在哪里?

标签: rposixct

解决方案


推荐阅读