Note that there are some explanatory texts on larger screens.

plurals
  1. POAdd and fill in rows based on data above/below
    primarykey
    data
    text
    <p>I've got a data set that looks like this:</p> <pre><code>Date&lt;-c("2009-05-1 10:00:00","2009-05-1 10:05:00","2009-05-1 10:10:00", "2009-05-1 10:15:00","2009-05-1 10:20:00","2009-05-1 10:25:00") Dates&lt;-strptime(Date, "%Y-%m-%d %H:%M:%S") DF&lt;-data.frame(Dates,X=1:6, Y=1:6) DF Dates X Y 1 2009-05-01 10:00:00 1 1 2 2009-05-01 10:05:00 2 2 3 2009-05-01 10:10:00 3 3 4 2009-05-01 10:15:00 4 4 5 2009-05-01 10:20:00 5 5 6 2009-05-01 10:25:00 6 6 </code></pre> <p>As is, the time stamp is every 5 minutes. But I need to have a data set that is every minute, so I'm looking to first add in the missing minute data, and then estimate the <code>X</code> and <code>Y</code> column data. With the <code>X</code> column being a simple fill of the data above, and the <code>Y</code> being an average of the above/below data.</p> <p>The results would hopefully look like this:</p> <pre><code> Dates X Y 2009-05-01 10:00:00 1 1 2009-05-01 10:01:00 1 1.5 2009-05-01 10:02:00 1 1.5 2009-05-01 10:03:00 1 1.5 2009-05-01 10:04:00 1 1.5 2009-05-01 10:05:00 2 2 2009-05-01 10:06:00 2 2.5 2009-05-01 10:07:00 2 2.5 2009-05-01 10:08:00 2 2.5 2009-05-01 10:09:00 2 2.5 2009-05-01 10:10:00 3 3 2009-05-01 10:11:00 3 3.5 2009-05-01 10:12:00 3 3.5 2009-05-01 10:13:00 3 3.5 2009-05-01 10:14:00 3 3.5 2009-05-01 10:15:00 4 4 2009-05-01 10:16:00 4 4.5 2009-05-01 10:17:00 4 4.5 2009-05-01 10:18:00 4 4.5 2009-05-01 10:19:00 4 4.5 2009-05-01 10:20:00 5 5 2009-05-01 10:21:00 5 5.5 2009-05-01 10:22:00 5 5.5 2009-05-01 10:23:00 5 5.5 2009-05-01 10:24:00 5 5.5 2009-05-01 10:25:00 6 6 </code></pre> <p>Any thoughts on how to go about doing this would be greatly appreciated.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload