Description Usage Arguments Details Value
In process data analysis we frequently need to calculate the duration between two events. since in most cases each event is a row, we can set a particular event as t0, with NA filled for all other rows except for the event of interest. Then we calcualte the lag time for the vector ts.
1 |
t0 |
A vector of time marks (integer, real, or Date), with some elements (at least the first) with non-NA values |
ts |
A vector of timestamps of the same length and type of t0. |
Note that the return value is of type "difftime"; ggplot and dplyr seem to have trouble with them. You can savely convert them to seconds using "as.numeric()".
A vector of real values that is ts-t0. When t0 is NA, it is back filled with the last nonNA value.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.