时间序列抛出错误信息

时间:2014-04-15 17:17:17

标签: r dataframe time-series

我正在尝试根据此数据集进行时间序列分析:

time    POINT_Y POINT_X
00:00   106.78  207.44
00:30   106.61  207.6
01:00   103.72  208.33
01:30   102.57  207.35
02:00   102.27  206.3
02:30   101.6   206.43
03:00   100.66  206.73
03:30   101.11  206.5
04:00   100.95  206.63
04:30   102.02  206.27
05:00   105.83  207.93
05:30   106.98  207.15
06:00   107.32  206.28
06:30   108.36  204.7
07:00   107.97  203.41
07:30   107.76  202.63
08:00   107.85  201.13
08:30   107.6   198.74

它被设置为:

austriacus<-read.table("austriacus.txt",header=T).

时间序列函数:x.ts<-ts(POINT_X,time)无效并产生以下错误消息:Error in is.data.frame(data) : object 'POINT_X' not found

有关于此的任何想法吗?

1 个答案:

答案 0 :(得分:1)

尝试动物园和chron套餐:

Lines <- "time    POINT_Y POINT_X
00:00   106.78  207.44
00:30   106.61  207.6
01:00   103.72  208.33
01:30   102.57  207.35
02:00   102.27  206.3
02:30   101.6   206.43
03:00   100.66  206.73
03:30   101.11  206.5
04:00   100.95  206.63
04:30   102.02  206.27
05:00   105.83  207.93
05:30   106.98  207.15
06:00   107.32  206.28
06:30   108.36  204.7
07:00   107.97  203.41
07:30   107.76  202.63
08:00   107.85  201.13
08:30   107.6   198.74
"

library(zoo)
library(chron)
to.times <- function(x) times(paste0(x, ":00"))

# z <- read.zoo("myfile", header = TRUE, FUN = to.times)
z <- read.zoo(text = Lines, header = TRUE, FUN = to.times)

plot(z)