Description Usage Arguments Details Value Author(s) See Also Examples

slopeEveryN calculates the slope of a vectorised data set (x) at N intervals. Slopes are calculated using the lm() function centred around every nth data point in the vector. Upon running the function, it attempts to subdivide the vector into n discrete intervals. If the vector length is not fully divisible by n, then the remainder elements are forced to NA values and the final slope calculated.

The function returns a labelled matrix, with the average index as the first column and the slope over that range of data. Units for slope then are technically in un

1 | ```
slopeEveryN(x, n = 2, lag = round(n/2))
``` |

`x` |
numeric vector containing the data over which slope is required. Typically this is a vector of data that has been sampled at even time intervals (represented by n). |

`n` |
the sample interval over which the slope will be calculated. Default is 2 (as in every 2nd data point). At minimum this must be >1. |

`lag` |
default value is half the sample interval, n, which will ensure the calculation is centred over the new sample interval. Not tested for any other situation. Leave blank to have function operate as intended. |

The general purpose of this function is to provide a moving average of a data stream typically sampled at evenly recorded time intervals common computerised data acquisition systems. Akin to a moving average function, except that it also resamples the data.

A matrix object returned

Glenn J. Tattersall

1 2 3 4 5 6 7 8 |

Thermimage documentation built on May 29, 2017, 6:47 p.m.

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.