Dear R users,
Could you share your knowledge on following problem:
Suppose we have dataframe:
ID TIME Data1 Data2 Data3
........... Data700
1. 2013-01-01 00:00:00 34 53 66
............ 55
2. 2013-01-01 00:00:01 333 4 5
............ 50
3. 2013-01-01 00:00:02 and so on
4. 2013-01-01 00:00:03 and so on
5. 2013-01-01 03:00:45 44 33 4
............. 66
6. 2013-01-01 03:00:46 46 35 7
............. 6
Notice that between ID 4 and ID 5 there is a gap, that instrument was
turned off. It started automatically in 2013-01-01 03:00:45 and continues
till the next turn off.
What I need R to do, is to find these gaps, and insert missing time values
with empty Data lines to have no gaps in time and empty (or NA) values in
data place:
ID TIME Data1 Data2 Data3
........... Data700
1. 2013-01-01 00:00:00 34 53 66
............ 55
2. 2013-01-01 00:00:01 333 4 5
............ 50
3. 2013-01-01 00:00:02 and so on
4. 2013-01-01 00:00:03 and so on
5. 2013-01-01
00:00:04
<- time with empty (or NA) data values inserted
6. 2013-01-01
00:00:05
<- time with empty (or NA) data values inserted
7. 2013-01-01
00:00:06
<- time with empty (or NA) data values inserted
................
and so on, until the time when instrument works again:
2013-01-01 03:00:45 44 33 4
............. 66
2013-01-01 03:00:46 46 35 7
............. 6
All your suggestions will be appreciated!
Simonas Kecorius
**
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.