Hi, I have a dataframe (try.1) with date/time and temperature columns, and the date/time is in POSIXct fomat. Sample included below.
I would like to to try decompose () or stl() to look at the trends and seasonality in my data, eventually so that I can look at autocorrelation. The series is 3 years of water temperature with clearly visible seasonal periods. Right now, if I try decompose, I get the following error, w hich I beleive is because I haven't correctly defined a time series. "Error in decompose(try.1) : time series has no or less than 2 periods"  I am stuck trying to go from POSIXct to as.ts Any suggestions on how to tackle this would be greatly appreciated.  Sincerely, Mary Ann A sample of the data looks like this: 'data.frame': 26925 obs. of 2 variables: $ date : POSIXct, format: "2008-07-11 21:00:00" "2008-07-11 22:00:00" ... $ DL_1297699: num 15.3 15.1 14.9 14.6 14.1 ...  date DL_1297699 1 2008-07-11 21:00:00 15.318 2 2008-07-11 22:00:00 15.127 3 2008-07-11 23:00:00 14.888 4 2008-07-12 00:00:00 14.553 5 2008-07-12 01:00:00 14.146 6 2008-07-12 02:00:00 13.738 7 2008-07-12 03:00:00 13.401 8 2008-07-12 04:00:00 13.088 9 2008-07-12 05:00:00 12.823 10 2008-07-12 06:00:00 12.630 and the dput(head(x,50) gives this output: structure(list(date = structure(c(1215810000, 1215813600, 1215817200, 1215820800, 1215824400, 1215828000, 1215831600, 1215835200, 1215838800, 1215842400, 1215846000, 1215849600, 1215853200, 1215856800, 1215860400, 1215864000, 1215867600, 1215871200, 1215874800, 1215878400, 1215882000, 1215885600, 1215889200, 1215892800, 1215896400, 1215900000, 1215903600, 1215907200, 1215910800, 1215914400, 1215918000, 1215921600, 1215925200, 1215928800, 1215932400, 1215936000, 1215939600, 1215943200, 1215946800, 1215950400, 1215954000, 1215957600, 1215961200, 1215964800, 1215968400, 1215972000, 1215975600, 1215979200, 1215982800, 1215986400), class = c("POSIXt", "POSIXct"), tzone = "UTC"), DL_1297699 = c(15.318, 15.127, 14.888, 14.553, 14.146, 13.738, 13.401, 13.088, 12.823, 12.63, 12.461, 12.413, 12.461, 12.703, 13.04, 13.497, 14.026, 14.553, 15.031, 15.366, 15.7, 15.819, 15.819, 15.7, 15.605, 15.461, 15.247, 14.984, 14.673, 14.337, 14.002, 13.666, 13.377, 13.137, 12.944, 12.823, 12.847, 13.016, 13.329, 13.762, 14.242, 14.697, 15.175, 15.581, 15.891, 16.034, 16.034, 15.939, 15.772, 15.581)), .Names = c("date", "DL_1297699"), row.names = c(NA, 50L), class = "data.frame") [[alternative HTML version deleted]]
______________________________________________ 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.