Hello, I am trying to read in some time series data and am having trouble. Forgive me, I am quite new to R. The data is in the form of:
"TS.1" "2000-07-28" 1419.89 "2000-07-31" 1430.83 "2000-08-01" 1438.1 "2000-08-02" 1438.7 "2000-08-03" 1452.56 "2000-08-04" 1462.93 "2000-08-07" 1479.32 "2000-08-08" 1482.8 "2000-08-09" 1472.87 "2000-08-10" 1460.25 "2000-08-11" 1471.84 "2000-08-14" 1491.56 "2000-08-15" 1484.43 ... The data is daily data, but it is irregular (i.e. there are some missing data points). I have tried reading in the data like so, but when I plot, the time series does not preserve the dates. sp500 <- ts(read.table("SP500.txt",header=TRUE)) plot.ts(sp500) I have searched the forums, and have found the current method to work: sp500 <- read.table("SP500.txt",header=TRUE) date <- sp500[,1] data <- sp500[,2] z <- aggregate(zoo(data), as.Date(date), tail, 1) merge(z, zoo(, as.Date(unclass(time(as.ts(z))), fill=0))) plot.zoo(z) However, now I cannot analyze the acf of the time series, as R complains giving an error: Error in na.fail.default(as.ts(x)) : missing values in object Is there any way to fix this? I would actually prefer not using the zoo class, as it breaks the acf function in R. Would the new zoo object be compatible with all the ts functions? Thank you! -- View this message in context: http://r.789695.n4.nabble.com/Reading-in-irregular-daily-time-series-data-tp3026688p3026688.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.