Question: I have some questions about my R code because my final plot is very strange, where am I going wrong? Where is the code incorrect?
I have some questions about my R code because my final plot is very strange, where am I going wrong? Where is the code incorrect?
Processing real data TS on US monthly CPI index. Clean up the data and create the TS plot:
This is my R code:
library(TSA) library(forecast) library(tidyverse) library(lubridate) library(readxl) data<- read_xlsx("CPIdata1971-2023.xlsx",skip = 11) data<- na.omit(data) data<- plyr::rename(data,c("Year" = "Year", "Jan" = "Jan", "Feb" = "Feb", "Mar" = "Mar", "Apr" = "Apr", "May" = "May", "Jun" = "Jun", "Jul" = "Jul", "Aug" = "Aug", "Sep" = "Sep", "Oct" = "Oct", "Nov" = "Nov", "Dec" = "Dec")) data tsdata<- ts(data, frequency=12, start = c(1971.00),end = c(2023.00)) autoplot(tsdata) + labs(y="CPI") Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts

Study Help