[R] Sampling data every third hour

R. Michael Weylandt michael.weylandt at gmail.com
Wed Dec 14 18:54:42 CET 2011


1) Use dput() to submit data.

2) Would this work? (It requires your data are evenly spaced, but I
think that's it) d[seq(1, nrow(d), by = 3), ]

Michael

On Wed, Dec 14, 2011 at 7:17 AM, abcdef ghijk <linehunk at yahoo.com> wrote:
>  Good Morning ,
>
> I want to sample the following time series for every third hour. For example at 00:00,03:00,06:00,09:00 etc.
>
>
> 2011-01-01 00:00:00 0.000000e+00
> 2011-01-01 01:00:00 1.471667e+01
> 2011-01-01 02:00:00 1.576667e+01
> 2011-01-01 03:00:00 0.000000e+00
> 2011-01-01 04:00:00 0.000000e+00
> 2011-01-01 05:00:00 0.000000e+00
> 2011-01-01 06:00:00 0.000000e+00
> 2011-01-01 07:00:00 0.000000e+00
> 2011-01-01 08:00:00 0.000000e+00
> 2011-01-01 09:00:00 1.826667e+01
> 2011-01-01 10:00:00 0.000000e+00
> 2011-01-01 11:00:00 0.000000e+00
> 2011-01-01 12:00:00 0.000000e+00
> 2011-01-01 13:00:00 0.000000e+00
> 2011-01-01 14:00:00 0.000000e+00
> 2011-01-01 15:00:00 0.000000e+00
> 2011-01-01 16:00:00 0.000000e+00
> 2011-01-01 17:00:00 0.000000e+00
> 2011-01-01 18:00:00 0.000000e+00
> 2011-01-01 19:00:00 0.000000e+00
> 2011-01-01 20:00:00 0.000000e+00
> 2011-01-01 21:00:00 7.010000e+01
> 2011-01-01 22:00:00 7.154167e+02
> 2011-01-01 23:00:00 2.039167e+02
> 2011-01-02 00:00:00 3.703000e+02
> 2011-01-02 01:00:00 9.130167e+02
> 2011-01-02 02:00:00 0.000000e+00
> 2011-01-02 03:00:00 0.000000e+00
> Thanks in advance.
> Regards,
> Shan
>
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list