Peter, Thank you very much for your help.
On Fri, Oct 4, 2024 at 9:19 PM Petr Pikal <petr....@gmail.com> wrote: > Hallo > > you can extract POSIX object > > tv <- as.POSIXct(index(dt_train)) > > and use cut together with aggregate > cut(tv, "hour") > > aggregate(dt_train, list(cut(tv, "hour")), mean) > > 2014-10-06 21:00:00 9.807692 > 2014-10-06 22:00:00 8.666667 > > Cheers. > Petr > > > > čt 3. 10. 2024 v 17:25 odesílatel roslinazairimah zakaria < > roslina...@gmail.com> napsal: > >> Dear all, >> >> My data is by minutes and I can see it has seasonal trend by daily and >> weekly. How do I decompose the minute data into daily and weekly >> >> some data: >> >> > dput(tail(dt_train,100))structure(c(11L, 11L, 10L, 10L, 10L, 10L, 10L, >> 10L, 10L, 10L, >> 10L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, >> 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, >> 10L, 11L, 11L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, >> 10L, 10L, 10L, 10L, 10L, 10L, 10L, 9L, 9L, 9L, 8L, 8L, 8L, 8L, >> 8L, 8L, 8L, 8L, 8L, 7L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, >> 8L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, >> 9L, 9L, 9L), class = c("xts", "zoo"), index = structure(c(1412622480, >> 1412622540, 1412622600, 1412622660, 1412622720, 1412622780, 1412622840, >> 1412622900, 1412622960, 1412623020, 1412623080, 1412623140, 1412623200, >> 1412623260, 1412623320, 1412623380, 1412623440, 1412623500, 1412623560, >> 1412623620, 1412623680, 1412623740, 1412623800, 1412623860, 1412623920, >> 1412623980, 1412624040, 1412624100, 1412624160, 1412624220, 1412624280, >> 1412624340, 1412624400, 1412624460, 1412624520, 1412624580, 1412624640, >> 1412624700, 1412624760, 1412624820, 1412624880, 1412624940, 1412625000, >> 1412625060, 1412625120, 1412625180, 1412625240, 1412625300, 1412625360, >> 1412625420, 1412625480, 1412625540, 1412625600, 1412625660, 1412625720, >> 1412625780, 1412625840, 1412625900, 1412625960, 1412626020, 1412626080, >> 1412626140, 1412626200, 1412626260, 1412626320, 1412626380, 1412626440, >> 1412626500, 1412626560, 1412626620, 1412626680, 1412626740, 1412626800, >> 1412626860, 1412626920, 1412626980, 1412627040, 1412627100, 1412627160, >> 1412627220, 1412627280, 1412627340, 1412627400, 1412627460, 1412627520, >> 1412627580, 1412627640, 1412627700, 1412627760, 1412627820, 1412627880, >> 1412627940, 1412628000, 1412628060, 1412628120, 1412628180, 1412628240, >> 1412628300, 1412628360, 1412628420), tzone = "", tclass = c("POSIXct", >> "POSIXt")), dim = c(100L, 1L)) >> >> >> I also attached the plot of training data. >> >> >> I tried : >> >> decompose(dt_train, type = "multiplicative", filter = NULL)Error in >> decompose(dt_train, type = "multiplicative", filter = NULL) : >> time series has no or less than 2 periods >> >> >> > stl(dt_train, s.window = "periodic")Error in stl(dt_train, s.window = >> "periodic") : >> series is not periodic or has less than two >> >> >> -- >> *Roslinazairimah Zakaria* >> *Tel: +609-5492370; Fax. No.+609-5492766* >> >> *Email: roslinazairi...@ump.edu.my <roslinazairi...@ump.edu.my>; >> roslina...@gmail.com <roslina...@gmail.com>* >> Faculty of Industrial Sciences & Technology >> University Malaysia Pahang >> Lebuhraya Tun Razak, 26300 Gambang, Pahang, Malaysia >> ______________________________________________ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> https://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > -- *Roslinazairimah Zakaria* *Tel: +609-5492370; Fax. No.+609-5492766* *Email: roslinazairi...@ump.edu.my <roslinazairi...@ump.edu.my>; roslina...@gmail.com <roslina...@gmail.com>* Faculty of Industrial Sciences & Technology University Malaysia Pahang Lebuhraya Tun Razak, 26300 Gambang, Pahang, Malaysia [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide https://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.