"coredata.xts(x) : currently unsupported data type" 创建 xts 时 object
"coredata.xts(x) : currently unsupported data type" when creating an xts object
我过去能够创建一个 xts object,其中包含 POSIX 格式的浮点数和日期的基本表格。但是我不知道为什么 xts 函数会在这种类型的数据上抛出错误。这是它的一个例子
enter image description here
以0继续,直到出现这种数据
enter image description here
我的代码如下
graph <- xts(sample$data, order.by = sample$date)
dygraph(graph)
并且会抛出我在主题标题中指定的错误。我有点困惑为什么会这样。
编辑:
出于测试目的使用 dput 重新缩放:
structure(list(data = list(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0), date = structure(c(1543434776.963,
1542820106.015, 1543615640.482, 1543851212.862, 1543854217.269,
1543930726.949, 1544030657.079, 1544034770.003, 1544043898.003,
1544457518.498, 1544460092.511, 1544467414.991, 1544470840.541,
1544628952.371, 1544473221.584, 1544631972.069, 1544646951.827,
1544645607.091, 1542833838.068, 1542819507.303), class = c("POSIXct",
"POSIXt"))), row.names = c(NA, 20L), class = "data.frame")
列 'data' 是 list
(由 str(sample)
检查),unlist
它到 vector
并且它应该工作
library(xts)
xts(unlist(sample$data), order.by = sample$date)
# [,1]
#2018-11-21 11:58:27 0
#2018-11-21 12:08:26 0
#2018-11-21 15:57:18 0
#2018-11-28 14:52:56 0
#2018-11-30 17:07:20 0
#2018-12-03 10:33:32 0
#2018-12-03 11:23:37 0
#2018-12-04 08:38:46 0
#2018-12-05 12:24:17 0
#2018-12-05 13:32:50 0
#2018-12-05 16:04:58 0
#2018-12-10 10:58:38 0
#2018-12-10 11:41:32 0
#2018-12-10 13:43:34 0
#2018-12-10 14:40:40 0
#2018-12-10 15:20:21 0
#2018-12-12 10:35:52 0
#2018-12-12 11:26:12 0
#2018-12-12 15:13:27 0
#2018-12-12 15:35:51 0
我过去能够创建一个 xts object,其中包含 POSIX 格式的浮点数和日期的基本表格。但是我不知道为什么 xts 函数会在这种类型的数据上抛出错误。这是它的一个例子
enter image description here
以0继续,直到出现这种数据
enter image description here
我的代码如下
graph <- xts(sample$data, order.by = sample$date)
dygraph(graph)
并且会抛出我在主题标题中指定的错误。我有点困惑为什么会这样。
编辑: 出于测试目的使用 dput 重新缩放:
structure(list(data = list(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0), date = structure(c(1543434776.963,
1542820106.015, 1543615640.482, 1543851212.862, 1543854217.269,
1543930726.949, 1544030657.079, 1544034770.003, 1544043898.003,
1544457518.498, 1544460092.511, 1544467414.991, 1544470840.541,
1544628952.371, 1544473221.584, 1544631972.069, 1544646951.827,
1544645607.091, 1542833838.068, 1542819507.303), class = c("POSIXct",
"POSIXt"))), row.names = c(NA, 20L), class = "data.frame")
列 'data' 是 list
(由 str(sample)
检查),unlist
它到 vector
并且它应该工作
library(xts)
xts(unlist(sample$data), order.by = sample$date)
# [,1]
#2018-11-21 11:58:27 0
#2018-11-21 12:08:26 0
#2018-11-21 15:57:18 0
#2018-11-28 14:52:56 0
#2018-11-30 17:07:20 0
#2018-12-03 10:33:32 0
#2018-12-03 11:23:37 0
#2018-12-04 08:38:46 0
#2018-12-05 12:24:17 0
#2018-12-05 13:32:50 0
#2018-12-05 16:04:58 0
#2018-12-10 10:58:38 0
#2018-12-10 11:41:32 0
#2018-12-10 13:43:34 0
#2018-12-10 14:40:40 0
#2018-12-10 15:20:21 0
#2018-12-12 10:35:52 0
#2018-12-12 11:26:12 0
#2018-12-12 15:13:27 0
#2018-12-12 15:35:51 0