#z is my raggidy zoo series
min15 <- times("00:15:00")
trunc(index(z), min15)

This looks like what I want I am just truncating the index to the
nearest 15 min interval.  a quick check with length confirms that they
are both of the same length.  I am just checking to make sure that I
am not missing something.  Thank you very much for your help.

Stephen



On Mon, Jun 28, 2010 at 5:05 PM, Gabor Grothendieck
<ggrothendi...@gmail.com> wrote:
> On Mon, Jun 28, 2010 at 5:52 PM, stephen sefick <ssef...@gmail.com> wrote:
>> Gabor,
>> This is very close, but it interpolates values that do not exist in
>> the original series.  Is there a way to just "snap" the series to a
>> grid without interpolating?
>>
>
> Just round up or down the times with trunc.  Using z from my prior
> post this rounds up to the next 10 minute boundary.  (If there are
> multiple data values in a 10 minute interval it takes the last value.)
>
> min10 <- times("00:10:00")
> halfsec <- times("00:00:01")/2
> aggregate(z, trunc(time(z) + as.numeric(min10 - halfsec), min10),
> function(x) tail(x, 1))
>
>
> If there is only data value in each 10 minute interval this will round
> it up.  If there are multiple data values in an interval it it takes
> the last one.
>



-- 
Stephen Sefick
____________________________________
| Auburn University                                   |
| Department of Biological Sciences           |
| 331 Funchess Hall                                  |
| Auburn, Alabama                                   |
| 36849                                                    |
|___________________________________|
| sas0...@auburn.edu                             |
| http://www.auburn.edu/~sas0025             |
|___________________________________|

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

                                                                -K. Mullis

______________________________________________
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.

Reply via email to