0

I am trying to read in yearly data with gaps using the read.zoo function from the zoo package. I am having some trouble finding the FUN that declares the data to be yearly data. The data set is located here.

The function call I am trying is

tsGDP <- read.zoo("us-gross-domestic-product-192919.csv", sep=",", format="%Y", 
 regular=FALSE, header=TRUE, index.column=1)
plot(log(tsGDP))  

This works fine, but it chokes when I try to plot the ACF of the series

> acf(tsGDP)
Error in na.fail.default(as.ts(x)) : missing values in object

This R-list posting seems to indicate that this is because I am not declaring yearly data correctly.

tchakravarty
  • 10,736
  • 12
  • 72
  • 116

1 Answers1

0

Without data , it is hard to reproduce problem. But , from the documentation of acf

By default, no missing values are allowed. If the na.action function passes through missing values (as na.pass does), the covariances are computed from the complete cases.

why not to try with

 acf(x = tsGDP, na.fail = na.pass)
agstudy
  • 119,832
  • 17
  • 199
  • 261