Hi All,
I have a data set of daily measurements of river flow. I would like to create a "ts" object from this data. Here's a sample data set: date <- as.Date(c(1:300), format="%Y") year=as.numeric(format(date, format = "%Y")) month=as.numeric(format(date, format = "%m")) julianday=as.numeric(format(date, format = "%j")) week=floor(julianday/7) flow <- sin(2*pi/53*c(1:300)) data <- cbind.data.frame(date,year,month,julianday,week, flow) I know how to do this with exact dates using the irts package: install.packages("tseries") library(tseries) data=cbind.data.frame(data,posixlt.time=as.POSIXlt(data$date, "PDT")) ##To create dates based on POSIXlt data.irts=irts(data$posixlt.time, data$flow) But I would like the time series object to be in the "ts" format. I tried using this code: data.ts=ts(data$flow, start=c(data$year[1], data$julianday[1]), frequency=365) Which does work, but I worry about the influence of leap years, since my data set is quite large. What is the way to properly code a ts object with daily measurements? Thank you! -Pam Pam Allen Vancouver, BC
______________________________________________ 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.