0

I created a time series in R Studio, where I try to analyse the CO2 emissions of the United States. I created a time series of the CO2 emissions and plotted it, which worked very well.

After that I tried to apply the acf() and pacf() functions, but R is saying that there is a mistake bec. "x has to be numeric". I don't unterstand why bec. I just have numeric values in my time series data set.

CHemission <- ts(dfCH$Emission, start = 1960, frequency = 1) #create a time series of the emission
plot(CHemission) # plot it
acf(CHemission) # apply acf, which unfortunately does not work.

Thank you much in advance for any help!!!

Paul
  • 2,850
  • 1
  • 12
  • 37
ruben
  • 1
  • 1
  • Hi, it seems that the problem is related to your data. Could you please copy/paste the result of `dput(CHemission)`, or, better, the output of `dput(dfCH)` in your question? If the dataset is too big, you could use `dput(head(dfCH))`. This will help making your [example reproducible](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – Paul Aug 10 '21 at 06:53
  • structure(c("780726.3", "552066.8", "440359", "436695.7", "436923", "475972.9", "522789.5", "433234", "468928.6", "577237.1", "771617.5", "876633", "931575.7", "968542.7", "988014.5", "1145607", "1196194", "1310311", "1462169", "1494860", "1467192", "1451501", "1580261", "1667029", "1814908", "1966553", "2068969", "2209709", "2369502", "2408541", "2173360", "2302190", "2418180", "2643530", "2763900", "), .Tsp = c(1960, 2016, 1), class = "ts") – ruben Aug 10 '21 at 06:55
  • Thanks for the data, unfortunately it does not produce usable object. They might be typos in the data you copy/pasted. For ex, there is `, ")` and even if I remove it is says that this is not enough to make a time serie object... – Paul Aug 10 '21 at 06:59

0 Answers0