为什么我的时间序列中没有正确的变量?

时间:2019-09-10 15:49:44

标签: r csv time-series

我正在尝试根据csv数据文件中一行的数字在R中进行一些预测。但是,在读取文件后,删除了文本列,并使用时间序列函数,我没有从行中获取值,也不知道从何处获取其值。

enter image description here

我尝试检查环境中的数据集,似乎对115个变量进行了1次观察,然后单击它就可以获取正确的数据,在其中可以每月观察到我所研究的内容,但是只需单击一下即可名称旁边的蓝色圆圈下拉列表,其中所有115个变量都描述为45至60级之间的因子。创建时间序列时,我尝试将它们向量化,但这不起作用。

library(TTR)
library(forecast)

# then read in the dataset
tourism <- read.csv2("tourism.csv")

# extract relevant rows, vectorize them, and create a timeseries for each    of the 3 groups

total <- tourism[3,]
total <- total[-1:-2]
total <- as.numeric(total)

foreig_tot <- tourism[4,]
foreig_tot <- foreig_tot[-1:-2]
foreig_tot <- as.numeric(foreig_tot)

norwegian <- tourism[5,]
norwegian <- norwegian[-1:-2]
norwegian <- as.numeric(norwegian)

total_ts <- ts(total, frequency = 12, start = c(2010,1))
foreig_tot_ts <- ts(foreig_tot, frequency = 12, start = c(2010,1))
norwegian_ts <- ts(norwegian, frequency = 12, start = c(2010,1))

创建时间序列时,我应该得到大约95000到150000的值,但是我得到的值应该在20到50 ish之间。

0 个答案:

没有答案