Note that there are some explanatory texts on larger screens.

plurals
  1. POR time series period subtract?
    primarykey
    data
    text
    <p>There are sample data of a user's event after 3 week ago :</p> <pre><code>&gt; subret uid event_name date count 2 10225 _e_io 2013-07-23 2 3 10225 _e_io 2013-07-24 3 4 10225 _e_io 2013-07-25 7 5 10225 _e_io 2013-07-26 6 6 10225 _e_io 2013-07-27 11 7 10225 _e_io 2013-07-28 4 8 10225 _e_io 2013-07-29 4 9 10225 _e_io 2013-07-30 2 10 10225 _e_io 2013-07-31 3 11 10225 _e_io 2013-08-01 1 12 10225 _e_io 2013-08-02 5 13 10225 _e_io 2013-08-03 2 14 10225 _e_io 2013-08-04 9 15 10225 _e_io 2013-08-05 13 16 10225 _e_io 2013-08-06 4 17 10225 _e_io 2013-08-07 14 18 10225 _e_io 2013-08-08 15 19 10225 _e_io 2013-08-09 11 20 10225 _e_io 2013-08-10 7 21 10225 _e_io 2013-08-11 2 22 10225 _e_renderer-load 2013-08-06 3 23 10225 _e_unknown 2013-07-29 1 24 10225 _e_unknown 2013-07-31 1 25 10225 _e_unknown 2013-08-01 1 26 10225 _e_unknown 2013-08-02 1 27 10225 _e_unknown 2013-08-06 4 28 10225 _e_unknown 2013-08-08 7 29 10225 _e_unknown 2013-08-10 3 </code></pre> <p>I don't know how to get the value of the weekly subtract of a event. It's hard to operation for one by one event supply the lost date count. Does R support subtract the value as a consistent key match (like <code>merge</code>) ?</p> <p>It's means :</p> <pre><code>&gt; ta &lt;- (subret[subret$event_name == "_e_io" &amp; subret$date &lt;= as.Date("2013-07-29"), ]) &gt; tb &lt;- (subret[subret$event_name == "_e_io" &amp; subret$date &gt; as.Date("2013-07-29") &amp; subret$date &lt;= as.Date("2013-08-05"), ]) &gt; (ta$count - tb$count / ta$count) [1] 1.000000 2.000000 6.857143 5.166667 10.818182 1.750000 0.750000 </code></pre> <p>I could get the increase speed every day of a week.</p> <h2>Updated</h2> <p>Sorry for the operation priority. Speed of weekly change should be:</p> <pre><code>&gt; ((ta$count - tb$count) / ta$count) [1] 0.0000000 0.0000000 0.8571429 0.1666667 0.8181818 -1.2500000 -2.2500000 </code></pre> <p>It's ok for <code>_e_io</code> that dates of a week are fully, but for others that dates of a week are not fully. Is that true I need pad the date alignment first? (use <code>merge</code> ?)</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.
    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