1

I am looking for a way to make regular discrete time intervals in R with data that is irregular and includes location information. (For example, 10 second intervals, and only the first location information per time interval).

The input data looks like this:

ID          Time           Location Duration

1 Mark 2015-04-15 23:55:41 1 145448
2 Mark 2015-04-15 23:58:07 9 1559
3 Mark 2015-04-15 23:58:08 9 2279
4 Mark 2015-04-15 23:58:11 9 557
5 Mark 2015-04-15 23:58:11 3 10540
6 Mark 2015-04-15 23:58:22 9 1783
7 Mark 2015-04-15 23:58:24 9 8706
8 Mark 2015-04-15 23:58:32 9 555
9 Mark 2015-04-15 23:58:33 2 124137
10 Mark 2015-04-16 00:00:37 2 7411
11 Mark 2015-04-16 00:00:37 20 7411

and the desired output would be:

ID          Time           Location 

1 Mark 2015-04-15 23:55:40 1
2 Mark 2015-04-15 23:55:50 1
3 Mark 2015-04-15 23:56:00 1
... 16 Mark 2015-04-15 23:58:00 9 17 Mark 2015-04-15 23:58:10 9

Any ideas?

Edding
  • 11
  • 1
  • look for example on this (http://stackoverflow.com/questions/13649019/with-r-split-time-series-data-into-time-intervals-say-an-hour-and-then-plot-t) question for breaking time series into bins – Yevgeny Tkach Jul 27 '15 at 12:33
  • Please use `dput(data)` and copy in the output to make it easier for us to look at your data. – rbatt Jul 27 '15 at 13:39
  • Thanks! using intervals <- data.frame(cut(ID$Time, breaks="10 secs")) then I sort duplicates with a for loop. – Edding Jul 29 '15 at 13:19

0 Answers0