Description Usage Arguments Value Author(s) See Also Examples

Replaces the values in `x`

with the result of applying an
`operation`

to it and the value that is `lag`

positions
either before it or after it in `x`

, depending on whether
`lag`

is positive or negative. For positive `lag`

the first `lag`

values will be `NA`

, while for negative
`lag`

the last `lag`

values will be `NA`

.
When `operation`

is `NULL`

, the values are moved
`lag`

positions down the vector.

1 | ```
calcLagged(x, operation = NULL, lag = 1)
``` |

`x` |
A |

`operation` |
A |

`lag` |
A |

A `vector`

containing the result of applying `operation`

to
values in `x`

. For positive `lag`

the first `lag`

values will
be `NA`

, while for negative `lag`

the last `lag`

values will be `NA`

.

Chris Brien

1 2 | ```
data(exampleData)
longi.dat$Days.diffs <- calcLagged(longi.dat$xDays, operation ="-")
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.