Dear community members,
I want to conduct analysis on time series dataset in csv. The data covers South Korea's GDP and vehicle kilometers traveled (VKT) from 1993 through 2017. I'm also referring to 'Forecasting: Principles and Practice' book by Professor Rob J Hyndman.
Whenever i try to explore my time series dataset with a slew of variables, and choose auto plot, i get this error:
Error: Objects of type tbl_df/tbl/data.frame not supported by autoplot.
The structure of my data set is as follows:
Year Passenger VKT GDP per capita TotalVKT PVKTpct TVKTpct
1993 2507 8740 225867 -3 1
1994 2893 10204 251671 16 11
.............................................................................................. ................................................
2017 6542 29744 474674 -2 -1
My code is also structured as follows:
Should i declare both key and index? But still it seems i can't identify my key if any.
library(fpp2)
library(tidyverse)
library(GGally)
library(tsibble)
library(dplyr)
#Attaching the dataset
koreatreg <- read_csv("timeseriesregression.csv")
#deletion of missing values
newkoreatreg <- na.omit(koreatreg)
#coerce a data frame to tssible by declaring the index
transkorreg <- as_tibble(newkoreatreg, index = Year)
#explore time series dataset
autoplot(transkorreg[,c('Passenger VKT','GDP per capita')]) +
ylab("% change") + xlab("Year")
I would greatly appreciate any timely reply!